From b23284cba28335f61595f2264685b1bbafc19183 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 18 Nov 2015 23:56:25 +0100 Subject: move moment.min.js and remove unneeded files --- library/moment/src/lib/duration/as.js | 55 ----------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 library/moment/src/lib/duration/as.js (limited to 'library/moment/src/lib/duration/as.js') diff --git a/library/moment/src/lib/duration/as.js b/library/moment/src/lib/duration/as.js deleted file mode 100644 index 03ecd6dab..000000000 --- a/library/moment/src/lib/duration/as.js +++ /dev/null @@ -1,55 +0,0 @@ -import { daysToMonths, monthsToDays } from './bubble'; -import { normalizeUnits } from '../units/aliases'; -import toInt from '../utils/to-int'; - -export function as (units) { - var days; - var months; - var milliseconds = this._milliseconds; - - units = normalizeUnits(units); - - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week' : return days / 7 + milliseconds / 6048e5; - case 'day' : return days + milliseconds / 864e5; - case 'hour' : return days * 24 + milliseconds / 36e5; - case 'minute' : return days * 1440 + milliseconds / 6e4; - case 'second' : return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': return Math.floor(days * 864e5) + milliseconds; - default: throw new Error('Unknown unit ' + units); - } - } -} - -// TODO: Use this.as('ms')? -export function valueOf () { - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); -} - -function makeAs (alias) { - return function () { - return this.as(alias); - }; -} - -export var asMilliseconds = makeAs('ms'); -export var asSeconds = makeAs('s'); -export var asMinutes = makeAs('m'); -export var asHours = makeAs('h'); -export var asDays = makeAs('d'); -export var asWeeks = makeAs('w'); -export var asMonths = makeAs('M'); -export var asYears = makeAs('y'); -- cgit v1.2.3