How to use the utc function from moment

Find comprehensive JavaScript moment.utc code examples handpicked from public code repositorys.

116
117
118
119
120
121
122
123
124
125
const amountInBaseUnit = BigNumber(transaction.value).div(1e6)
let output = {
  amount: amountInBaseUnit.toString(10),
  fromAddress: transaction.from,
  toAddress: transaction.to,
  date: moment.utc(parseInt(transaction.expirationTime) * 1000).format(),
  transactionVersion: parseInt(transaction.version),
  explorerLink: `https://libexplorer.com/version/${transaction.version}`
}
// Mint
fork icon43
star icon141
watch icon32

67
68
69
70
71
72
73
74
75
76

async.eachSeries(docs, function(user, cb){
  try{
    // console.log('Processing', user._id);
    var plan = subscriptions.blocks[user.purchased.plan.planId];
    var lastBillingDate = moment.utc(user.purchased.plan.lastBillingDate);

    if(!plan){
      throw new Error('Plan ' + user.purchased.plan.planId + ' does not exists. User ' + user._id);
    }
fork icon6
star icon8
watch icon0

+ 5 other calls in file

21
22
23
24
25
26
27
28
29
30
var error_code = account.error_code;

res.locals.account = req.account = account;

if (last_sync) {
  res.locals.account.last_sync = moment.utc(last_sync).fromNow();
}

if (error_code) {
  res.locals.account.folder_missing = error_code === 409;
fork icon69
star icon0
watch icon23

+ 3 other calls in file

92
93
94
95
96
97
98
99
100
  draft: is_draft,
  metadata: metadata,
  size: stat.size,
  dependencies: dependencies,
  dateStamp: DateStamp(blog, path, metadata),
  updated: moment.utc(stat.mtime).valueOf(),
};

if (entry.dateStamp === undefined) delete entry.dateStamp;
fork icon69
star icon0
watch icon23

455
456
457
458
459
460
461
462
463
464
465
  children: 0,
  total_pending_payout_value: '0.000 HBD',
  total_payout_value: '0.000 HBD',
  pending_payout_value: '0.000 HBD',
  curator_payout_value: '0.000 HBD',
  cashout_time: moment.utc().add(7, 'days').toDate(),
  body: `@${field.creator} added ${field.name} (${field.locale})`,
});


const getExposedFields = (objectType, fields) => {
fork icon0
star icon3
watch icon3

150
151
152
153
154
155
156
157
158
159

var is_schedule_order = request_data_body.is_schedule_order;
var schedule_order_start_at = null;
var schedule_order_start_at2 = null;
if (is_schedule_order) {
    schedule_order_start_at = moment.utc(Number(request_data_body.order_start_at)).format();
    if (request_data_body.order_start_at2) {
        schedule_order_start_at2 = moment.utc(Number(request_data_body.order_start_at2)).format();
    }
} else {
fork icon0
star icon0
watch icon1

+ 11 other calls in file

43
44
45
46
47
48
49
50
51
52
const datoFecha2 = result["SOLICI_FEC_FIN"];
const datoFecha3 = result["SOLICI_FECMOD"];
const datoFecha4 = result["SOLICI_FECING"];

const fechaBolv1 = (moment.utc(datoFecha1).isValid() ? moment.utc(datoFecha1).format('DD/MM/YYYY') : '-----------------------');
const fechaBolv2 = (moment.utc(datoFecha2).isValid() ? moment.utc(datoFecha2).format('DD/MM/YYYY') : '-----------------------');
const fechaBolv3 = (moment.utc(datoFecha3).isValid() ? moment.utc(datoFecha3).format('DD/MM/YYYY') : '-----------------------');
const fechaBolv4 = (moment.utc(datoFecha4).isValid() ? moment.utc(datoFecha4).format('DD/MM/YYYY') : '-----------------------');

//FUENTE
fork icon0
star icon0
watch icon1

+ 3 other calls in file

52
53
54
55
56
57
58
59
60
61
disabledSince: {
  type: Date,
},
lastAccess: {
  type: Date,
  default: moment.utc(),
},
/**
 * valid user types:
 *  guest -> a guest user
fork icon0
star icon0
watch icon2

+ 4 other calls in file

12
13
14
15
16
17
18
19
20
21
const status = suburbService.getSuburbStatus(newStatus);
if (suburb && status) {
  const addStatus = await suburbService.suburbAddStatus(suburbId, {
    ...status,
    details,
    transtime: moment.utc(),
  });
  if (addStatus) {
    if (status.status === "approved") {
      await userService.updateUser({
fork icon0
star icon0
watch icon2

49
50
51
52
53
54
55
56
57
58
59
60
}


function getMaximum(punchArray) {
  const max = punchArray.reduce(function (prev, current) {
    const prev_moment = moment.utc(prev.punching_time, "HH:mm")
    const curr_moment = moment.utc(current.punching_time, "HH:mm")


    return prev_moment > curr_moment ? prev : current;
  }).punching_time;

fork icon0
star icon0
watch icon0

+ 5 other calls in file