How to use moment.substract:
2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151
newl = newplan[0].newplan } return newl } function substract(date1, date2) { return moment.substract(date1, date2).days(); }
How to use moment.js:
GitHub: ferrolho/magnet-player
167 168 169 170 171 172 173 174 175 176
} } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"moment":3,"pretty-bytes":4}],3:[function(require,module,exports){ //! moment.js ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) :
138
456
27
See more examples
How to use moment.add:
56 57 58 59 60 61 62 63 64 65
// '30 days 12 hours'::interval in Postgres database is retrieved as // PostgresInterval object { days: 30, hours: 12 } in here. Iterating through // each object key and mutating count (add, subtract). Object.keys(interval).forEach((key) => { // e.g. moment.add(<count>, <unit>) mutatedDate[mutation](interval[key], key) }) return mutatedDate
How to use moment.parseZone:
452 453 454 455 456 457 458 459 460 461
str = str.replace("Z","+00:00");//incoming jobs have wrong date format, this attempts to correct it } if (tz == "50") //translate between momentjs and ffastrans timezone tz = "30" var to_parse = str.replace(/...$/,":" + tz); var parsed = moment.parseZone(to_parse) return parsed.format("YYYY-MM-DD HH:mm:ss"); }catch(ex){ console.error("Error getDate: " +str);
How to use moment.min:
120 121 122 123 124 125 126 127 128 129
if (isDateTimeFormat(startTime)) { d = moment(startTime, 'YYYY-MM-DD HH:mm:ss') } else { d = moment(layer.startDate, 'YYYY-MM-DD') } startDate = moment.min(startDate, d) } } if (startDate.isValid()) {
175
633
46
See more examples
How to use moment.default:
41 42 43 44 45 46 47 48 49 50
nextStatusTimes += order.eta_next_status_times[key]; } }); } totalEta += nextStatusTimes; var diffTimeAsSeconds = _moment.default.utc(order === null || order === void 0 ? void 0 : (_order$reporting_data = order.reporting_data) === null || _order$reporting_data === void 0 ? void 0 : _order$reporting_data.at["status:".concat(order.status)]).add(order === null || order === void 0 ? void 0 : order.eta_current_status_time, 'minutes').diff((0, _moment.default)().utc(), 'seconds'); var diffTimeAsMinutes = Math.ceil(diffTimeAsSeconds / 60); if (diffTimeAsMinutes <= 0) { totalEta += Math.floor(Math.abs(diffTimeAsMinutes / (order === null || order === void 0 ? void 0 : order.eta_current_status_time)) + 1) * (order === null || order === void 0 ? void 0 : order.eta_current_status_penalty_time); }
How to use moment.period:
GitHub: albinscode/atgenerator
6 7 8 9 10 11 12 13 14 15
// This will enable us to specify a period (week, month, year) with an added or substracted value. // For example, week+2, month+4, etc... this.parsePeriod = function(json) { // We apply some period analysis (TODO see where to do this in a more business dedicated object) var range1 = moment.period(json.startDate); var range2 = moment.period(json.endDate); // The first date can be used to only define a period (current month, year, etc...) if (range1 !== undefined) {
How to use moment.isMoment:
14 15 16 17 18 19 20 21 22 23
make(): Moment { return moment(...arguments) } isMoment(value: any): boolean { return moment.isMoment(value) } setNow(cb: () => any): this { moment.now = cb
How to use moment.range:
GitHub: rijwanshop/esop
352 353 354 355 356 357 358 359 360 361 362 363
moment.range.constructor = DateRange; /** * @deprecated */ moment.fn.range = moment.range; /** * Check if the current moment is within a given date range. *
How to use moment.unix:
GitHub: Protected/rowboat
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
if (!group) return; let announcement = group.announcement; if (!announcement) return; if (now) now = moment.unix(now); else now = moment(); let emb = null, message = await this.getAnnouncementMessage(group.id, announcement.id); if (message && message.embeds[0]) {
How to use moment.duration:
105 106 107 108 109 110 111 112 113 114
if (chat) fs.writeJSONSync(file_path, chat); return chat; } const convertTimestamp = (timestamp) => moment.duration(timestamp, 'seconds') .toISOString() .replace(/P.*?T(?:(\d+?)H)?(?:(\d+?)M)?(?:(\d+).*?S)?/, (_, ...ms) => { const seg = v => v ? v.padStart(2, '0') : '00';
220
0
32
See more examples
How to use moment.max:
69 70 71 72 73 74 75 76 77 78
} } if (tolerant) warn('Validation enforcement disabled') let startDate = moment.max() async function main () { for (const layerId of Object.keys(wv.layers)) { let layer = wv.layers[layerId]
175
633
46
See more examples
How to use moment.locale:
GitHub: medic/cht-core
22 23 24 25 26 27 28 29 30 31
$translate, SetLanguageCookie ) { 'ngInject'; return function(code, setLanguageCookie) { moment.locale([code, 'en']); $translate.use(code); if (setLanguageCookie !== false) { SetLanguageCookie(code);
185
408
53
See more examples
How to use moment.utc:
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
43
141
32
See more examples