UNPKG

sugar

Version:

A Javascript utility library for working with native objects.

68 lines (65 loc) 1.13 kB
'use strict'; var getDaysInMonth = require('../internal/getDaysInMonth'); var DateUnits = [ { name: 'millisecond', method: 'Milliseconds', multiplier: 1, start: 0, end: 999 }, { name: 'second', method: 'Seconds', multiplier: 1000, start: 0, end: 59 }, { name: 'minute', method: 'Minutes', multiplier: 60 * 1000, start: 0, end: 59 }, { name: 'hour', method: 'Hours', multiplier: 60 * 60 * 1000, start: 0, end: 23 }, { name: 'day', alias: 'date', method: 'Date', ambiguous: true, multiplier: 24 * 60 * 60 * 1000, start: 1, end: function(d) { return getDaysInMonth(d); } }, { name: 'week', method: 'ISOWeek', ambiguous: true, multiplier: 7 * 24 * 60 * 60 * 1000 }, { name: 'month', method: 'Month', ambiguous: true, multiplier: 30.4375 * 24 * 60 * 60 * 1000, start: 0, end: 11 }, { name: 'year', method: 'FullYear', ambiguous: true, multiplier: 365.25 * 24 * 60 * 60 * 1000, start: 0 } ]; module.exports = DateUnits;