function hooks() { return hookCallback.apply(null, arguments); }
n/a
ISO_8601 = function () {}
n/a
RFC_2822 = function () {}
n/a
function getCalendarFormat(myMoment, now) { var diff = myMoment.diff(now, 'days', true); return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; }
n/a
createFromInputFallback = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function defineLocale(name, config) { if (config !== null) { var parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); parentConfig = locales[name]._config; } else if (config.parentLocale != null) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { if (!localeFamilies[config.parentLocale]) { localeFamilies[config.parentLocale] = []; } localeFamilies[config.parentLocale].push({ name: name, config: config }); return null; } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); if (localeFamilies[name]) { localeFamilies[name].forEach(function (x) { defineLocale(x.name, x.config); }); } // backwards compat for now: also set the locale // make sure we set the locale AFTER all child locales have been // created, so we won't end up with the child locale set. getSetGlobalLocale(name); return locales[name]; } else { // useful for testing delete locales[name]; return null; } }
n/a
function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms : input._milliseconds, d : input._days, M : input._months }; } else if (isNumber(input)) { duration = {}; if (key) { duration[key] = input; } else { duration.milliseconds = input; } } else if (!!(match = aspNetRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : 0, d : toInt(match[DATE]) * sign, h : toInt(match[HOUR]) * sign, m : toInt(match[MINUTE]) * sign, s : toInt(match[SECOND]) * sign, ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match }; } else if (!!(match = isoRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : parseIso(match[2], sign), M : parseIso(match[3], sign), w : parseIso(match[4], sign), d : parseIso(match[5], sign), h : parseIso(match[6], sign), m : parseIso(match[7], sign), s : parseIso(match[8], sign) }; } else if (duration == null) {// checks for null or undefined duration = {}; } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } return ret; }
n/a
function createInvalid(flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; }
n/a
function isDate(input) { return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; }
n/a
function isDuration(obj) { return obj instanceof Duration; }
n/a
function isMoment(obj) { return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); }
...
function tz (input) {
var args = Array.prototype.slice.call(arguments, 0, -1),
name = arguments[arguments.length - 1],
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
...
lang = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
langData = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function getSetGlobalLocale(key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } } return globalLocale._abbr; }
n/a
function getLocale(key) { var locale; if (key && key._locale && key._locale._abbr) { key = key._locale._abbr; } if (!key) { return globalLocale; } if (!isArray(key)) { //short-circuit everything else locale = loadLocale(key); if (locale) { return locale; } key = [key]; } return chooseLocale(key); }
n/a
function listLocales() { return keys$1(locales); }
n/a
function max() { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); }
n/a
function min() { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); }
...
return output;
}
function packBase60(number, precision) {
var output = '',
absolute = Math.abs(number),
whole = Math.floor(absolute),
fraction = packBase60Fraction(absolute - whole, Math.min(~~precision, 10));
while (whole > 0) {
output = BASE60[whole % 60] + output;
whole = Math.floor(whole / 60);
}
if (number < 0) {
...
function hooks() { return hookCallback.apply(null, arguments); }
n/a
function listMonths(format, index) { return listMonthsImpl(format, index, 'months'); }
n/a
function listMonthsShort(format, index) { return listMonthsImpl(format, index, 'monthsShort'); }
n/a
function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; }
n/a
now = function () { return Date.now ? Date.now() : +(new Date()); }
n/a
parseTwoDigitYear = function (input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); }
n/a
function createInZone() { return createLocal.apply(null, arguments).parseZone(); }
n/a
function getSetRelativeTimeRounding(roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof(roundingFunction) === 'function') { round = roundingFunction; return true; } return false; }
n/a
function getSetRelativeTimeThreshold(threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; }
n/a
function tz(input) { var args = Array.prototype.slice.call(arguments, 0, -1), name = arguments[arguments.length - 1], zone = getZone(name), out = moment.utc.apply(null, args); if (zone && !moment.isMoment(input) && needsOffset(out)) { out.add(zone.parse(out), 'minutes'); } out.tz(name); return out; }
...
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
tz.version = VERSION;
tz.dataVersion = '';
tz._zones = zones;
...
function Zone(packedString) { if (packedString) { this._set(unpack(packedString)); } }
n/a
function createUnix(input) { return createLocal(input * 1000); }
n/a
function updateLocale(name, config) { if (config != null) { var locale, parentConfig = baseConfig; // MERGE if (locales[name] != null) { parentConfig = locales[name]._config; } config = mergeConfigs(parentConfig, config); locale = new Locale(config); locale.parentLocale = locales[name]; locales[name] = locale; // backwards compat for now: also set the locale getSetGlobalLocale(name); } else { // pass null for config to unupdate, useful for tests if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; }
n/a
updateOffset = function (mom, keepTime) { var zone = moment.defaultZone, offset; if (mom._z === undefined) { if (zone && needsOffset(mom) && !mom._isUTC) { mom._d = moment.utc(mom._a)._d; mom.utc().add(zone.parse(mom), 'minutes'); } mom._z = zone; } if (mom._z) { offset = mom._z.offset(mom); if (Math.abs(offset) < 16) { offset = offset / 60; } if (mom.utcOffset !== undefined) { mom.utcOffset(-offset, keepTime); } else { mom.zone(offset, keepTime); } } }
...
}
};
fn.tz = function (name) {
if (name) {
this._z = getZone(name);
if (this._z) {
moment.updateOffset(this);
} else {
logError("Moment Timezone has no data for " + name + ". See http://momentjs.com/timezone/docs/#/data-loading/.
x22;);
}
return this;
}
if (this._z) { return this._z.name; }
};
...
function createUTC(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); }
...
moment.updateOffset = function (mom, keepTime) {
var zone = moment.defaultZone,
offset;
if (mom._z === undefined) {
if (zone && needsOffset(mom) && !mom._isUTC) {
mom._d = moment.utc(mom._a)._d;
mom.utc().add(zone.parse(mom), 'minutes');
}
mom._z = zone;
}
if (mom._z) {
offset = mom._z.offset(mom);
if (Math.abs(offset) < 16) {
...
function listWeekdays(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); }
n/a
function listWeekdaysMin(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); }
n/a
function listWeekdaysShort(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); }
n/a
function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms : input._milliseconds, d : input._days, M : input._months }; } else if (isNumber(input)) { duration = {}; if (key) { duration[key] = input; } else { duration.milliseconds = input; } } else if (!!(match = aspNetRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : 0, d : toInt(match[DATE]) * sign, h : toInt(match[HOUR]) * sign, m : toInt(match[MINUTE]) * sign, s : toInt(match[SECOND]) * sign, ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match }; } else if (!!(match = isoRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : parseIso(match[2], sign), M : parseIso(match[3], sign), w : parseIso(match[4], sign), d : parseIso(match[5], sign), h : parseIso(match[6], sign), m : parseIso(match[7], sign), s : parseIso(match[8], sign) }; } else if (duration == null) {// checks for null or undefined duration = {}; } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } return ret; }
n/a
function createInvalid$1() { return createDuration(NaN); }
n/a
function bubble() { var milliseconds = this._milliseconds; var days = this._days; var months = this._months; var data = this._data; var seconds, minutes, hours, years, monthsFromDays; // if we have a mix of positive and negative values, bubble down first // check: https://github.com/moment/moment/issues/2166 if (!((milliseconds >= 0 && days >= 0 && months >= 0) || (milliseconds <= 0 && days <= 0 && months <= 0))) { milliseconds += absCeil(monthsToDays(months) + days) * 864e5; days = 0; months = 0; } // The following code bubbles up values, see the tests for // examples of what that means. data.milliseconds = milliseconds % 1000; seconds = absFloor(milliseconds / 1000); data.seconds = seconds % 60; minutes = absFloor(seconds / 60); data.minutes = minutes % 60; hours = absFloor(minutes / 60); data.hours = hours % 24; days += absFloor(hours / 24); // convert days to months monthsFromDays = absFloor(daysToMonths(days)); months += monthsFromDays; days -= absCeil(monthsToDays(monthsFromDays)); // 12 months -> 1 year years = absFloor(months / 12); months %= 12; data.days = days; data.months = months; data.years = years; return this; }
n/a
function abs() { var data = this._data; this._milliseconds = mathAbs(this._milliseconds); this._days = mathAbs(this._days); this._months = mathAbs(this._months); data.milliseconds = mathAbs(data.milliseconds); data.seconds = mathAbs(data.seconds); data.minutes = mathAbs(data.minutes); data.hours = mathAbs(data.hours); data.months = mathAbs(data.months); data.years = mathAbs(data.years); return this; }
...
function ZoneScore(zone) {
this.zone = zone;
this.offsetScore = 0;
this.abbrScore = 0;
}
ZoneScore.prototype.scoreOffsetAt = function (offsetAt) {
this.offsetScore += Math.abs(this.zone.offset(offsetAt.at) - offsetAt.offset);
if (this.zone.abbr(offsetAt.at).replace(/[^A-Z]/g, '') !== offsetAt.abbr) {
this.abbrScore++;
}
};
function findChange(low, high) {
var mid, diff;
...
function add$1(input, value) { return addSubtract$1(this, input, value, 1); }
...
function tz (input) {
var args = Array.prototype.slice.call(arguments, 0, -1),
name = arguments[arguments.length - 1],
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
...
function as(units) { if (!this.isValid()) { return NaN; } 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); } } }
n/a
asDays = function () { return this.as(alias); }
n/a
asHours = function () { return this.as(alias); }
n/a
asMilliseconds = function () { return this.as(alias); }
n/a
asMinutes = function () { return this.as(alias); }
n/a
asMonths = function () { return this.as(alias); }
n/a
asSeconds = function () { return this.as(alias); }
n/a
asWeeks = function () { return this.as(alias); }
n/a
asYears = function () { return this.as(alias); }
n/a
days = function () { return this.isValid() ? this._data[name] : NaN; }
n/a
function get$2(units) { units = normalizeUnits(units); return this.isValid() ? this[units + 's']() : NaN; }
n/a
hours = function () { return this.isValid() ? this._data[name] : NaN; }
n/a
function humanize(withSuffix) { if (!this.isValid()) { return this.localeData().invalidDate(); } var locale = this.localeData(); var output = relativeTime$1(this, !withSuffix, locale); if (withSuffix) { output = locale.pastFuture(+this, output); } return locale.postformat(output); }
n/a
function isValid$1() { return this._isValid; }
n/a
lang = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function locale(key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } }
n/a
function localeData() { return this._locale; }
n/a
milliseconds = function () { return this.isValid() ? this._data[name] : NaN; }
n/a
minutes = function () { return this.isValid() ? this._data[name] : NaN; }
n/a
months = function () { return this.isValid() ? this._data[name] : NaN; }
n/a
seconds = function () { return this.isValid() ? this._data[name] : NaN; }
n/a
function subtract$1(input, value) { return addSubtract$1(this, input, value, -1); }
n/a
function toISOString$1() { // for ISO strings we do not use the normal bubbling rules: // * milliseconds bubble up until they become hours // * days do not bubble at all // * months bubble up until they become years // This is because there is no context-free conversion between hours and days // (think of clock changes) // and also not between days and months (28-31 days per month) if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds = abs$1(this._milliseconds) / 1000; var days = abs$1(this._days); var months = abs$1(this._months); var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour minutes = absFloor(seconds / 60); hours = absFloor(minutes / 60); seconds %= 60; minutes %= 60; // 12 months -> 1 year years = absFloor(months / 12); months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js var Y = years; var M = months; var D = days; var h = hours; var m = minutes; var s = seconds; var total = this.asSeconds(); if (!total) { // this is the same as C#'s (Noda) and python (isodate)... // but not other JS (goog.date) return 'P0D'; } return (total < 0 ? '-' : '') + 'P' + (Y ? Y + 'Y' : '') + (M ? M + 'M' : '') + (D ? D + 'D' : '') + ((h || m || s) ? 'T' : '') + (h ? h + 'H' : '') + (m ? m + 'M' : '') + (s ? s + 'S' : ''); }
n/a
toIsoString = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function toISOString$1() { // for ISO strings we do not use the normal bubbling rules: // * milliseconds bubble up until they become hours // * days do not bubble at all // * months bubble up until they become years // This is because there is no context-free conversion between hours and days // (think of clock changes) // and also not between days and months (28-31 days per month) if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds = abs$1(this._milliseconds) / 1000; var days = abs$1(this._days); var months = abs$1(this._months); var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour minutes = absFloor(seconds / 60); hours = absFloor(minutes / 60); seconds %= 60; minutes %= 60; // 12 months -> 1 year years = absFloor(months / 12); months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js var Y = years; var M = months; var D = days; var h = hours; var m = minutes; var s = seconds; var total = this.asSeconds(); if (!total) { // this is the same as C#'s (Noda) and python (isodate)... // but not other JS (goog.date) return 'P0D'; } return (total < 0 ? '-' : '') + 'P' + (Y ? Y + 'Y' : '') + (M ? M + 'M' : '') + (D ? D + 'D' : '') + ((h || m || s) ? 'T' : '') + (h ? h + 'H' : '') + (m ? m + 'M' : '') + (s ? s + 'S' : ''); }
n/a
function toISOString$1() { // for ISO strings we do not use the normal bubbling rules: // * milliseconds bubble up until they become hours // * days do not bubble at all // * months bubble up until they become years // This is because there is no context-free conversion between hours and days // (think of clock changes) // and also not between days and months (28-31 days per month) if (!this.isValid()) { return this.localeData().invalidDate(); } var seconds = abs$1(this._milliseconds) / 1000; var days = abs$1(this._days); var months = abs$1(this._months); var minutes, hours, years; // 3600 seconds -> 60 minutes -> 1 hour minutes = absFloor(seconds / 60); hours = absFloor(minutes / 60); seconds %= 60; minutes %= 60; // 12 months -> 1 year years = absFloor(months / 12); months %= 12; // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js var Y = years; var M = months; var D = days; var h = hours; var m = minutes; var s = seconds; var total = this.asSeconds(); if (!total) { // this is the same as C#'s (Noda) and python (isodate)... // but not other JS (goog.date) return 'P0D'; } return (total < 0 ? '-' : '') + 'P' + (Y ? Y + 'Y' : '') + (M ? M + 'M' : '') + (D ? D + 'D' : '') + ((h || m || s) ? 'T' : '') + (h ? h + 'H' : '') + (m ? m + 'M' : '') + (s ? s + 'S' : ''); }
n/a
function valueOf$1() { if (!this.isValid()) { return NaN; } return ( this._milliseconds + this._days * 864e5 + (this._months % 12) * 2592e6 + toInt(this._months / 12) * 31536e6 ); }
n/a
function weeks() { return absFloor(this.days() / 7); }
n/a
years = function () { return this.isValid() ? this._data[name] : NaN; }
n/a
add = function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period ). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }
...
function tz (input) {
var args = Array.prototype.slice.call(arguments, 0, -1),
name = arguments[arguments.length - 1],
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
...
function calendar$1(time, formats) { // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're local/utc/offset or not. var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), format = hooks.calendarFormat(this, sod) || 'sameElse'; var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); return this.format(output || this.localeData().calendar(format, this, createLocal(now))); }
n/a
function clone() { return new Moment(this); }
n/a
function creationData() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict }; }
n/a
date = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
dates = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, 'd'); } else { return day; } }
n/a
function getSetDayOfYear(input) { var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); }
n/a
function getSetDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); if (input != null) { input = parseWeekday(input, this.localeData()); return this.add(input - day, 'd'); } else { return day; } }
n/a
function getDaysInMonth() { return daysInMonth(this.year(), this.month()); }
n/a
function diff(input, units, asFloat) { var that, zoneDelta, delta, output; if (!this.isValid()) { return NaN; } that = cloneWithOffset(input, this); if (!that.isValid()) { return NaN; } zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; units = normalizeUnits(units); if (units === 'year' || units === 'month' || units === 'quarter') { output = monthDiff(this, that); if (units === 'quarter') { output = output / 3; } else if (units === 'year') { output = output / 12; } } else { delta = this - that; output = units === 'second' ? delta / 1e3 : // 1000 units === 'minute' ? delta / 6e4 : // 1000 * 60 units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst delta; } return asFloat ? output : absFloor(output); }
n/a
function endOf(units) { units = normalizeUnits(units); if (units === undefined || units === 'millisecond') { return this; } // 'date' is an alias for 'day', so it should be considered as such. if (units === 'date') { units = 'day'; } return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); }
n/a
function format(inputString) { if (!inputString) { inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; } var output = formatMoment(this, inputString); return this.localeData().postformat(output); }
...
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license
-url] [![Build Status][travis-image]][travis-url]
IANA Time Zone Database + [Moment.js](http://momentjs.com).
```js
var june = moment("2014-06-01T12:00:00Z");
june.tz('America/Los_Angeles').format('ha z'); // 5am PDT
june.tz('America/New_York').format('ha z'); // 8am EDT
june.tz('Asia/Tokyo').format('ha z'); // 9pm JST
june.tz('Australia/Sydney').format('ha z'); // 10pm EST
var dec = moment("2014-12-01T12:00:00Z");
dec.tz('America/Los_Angeles').format('ha z'); // 4am PST
dec.tz('America/New_York').format('ha z'); // 7am EST
...
function from(time, withoutSuffix) { if (this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid())) { return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } }
n/a
function fromNow(withoutSuffix) { return this.from(createLocal(), withoutSuffix); }
n/a
function stringGet(units) { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](); } return this; }
n/a
function hasAlignedHourOffset(input) { if (!this.isValid()) { return false; } input = input ? createLocal(input).utcOffset() : 0; return (this.utcOffset() - input) % 60 === 0; }
n/a
hour = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
hours = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
function inspect() { if (!this.isValid()) { return 'moment.invalid(/* ' + this._i + ' */)'; } var func = 'moment'; var zone = ''; if (!this.isLocal()) { func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; zone = 'Z'; } var prefix = '[' + func + '("]'; var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY'; var datetime = '-MM-DD[T]HH:mm:ss.SSS'; var suffix = zone + '[")]'; return this.format(prefix + year + datetime + suffix); }
n/a
function invalidAt() { return getParsingFlags(this).overflow; }
n/a
function isAfter(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); if (units === 'millisecond') { return this.valueOf() > localInput.valueOf(); } else { return localInput.valueOf() < this.clone().startOf(units).valueOf(); } }
n/a
function isBefore(input, units) { var localInput = isMoment(input) ? input : createLocal(input); if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); if (units === 'millisecond') { return this.valueOf() < localInput.valueOf(); } else { return this.clone().endOf(units).valueOf() < localInput.valueOf(); } }
n/a
function isBetween(from, to, units, inclusivity) { inclusivity = inclusivity || '()'; return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); }
n/a
function isDaylightSavingTime() { return ( this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset() ); }
n/a
isDSTShifted = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function getIsLeapYear() { return isLeapYear(this.year()); }
n/a
function isLocal() { return this.isValid() ? !this._isUTC : false; }
n/a
function isSame(input, units) { var localInput = isMoment(input) ? input : createLocal(input), inputMs; if (!(this.isValid() && localInput.isValid())) { return false; } units = normalizeUnits(units || 'millisecond'); if (units === 'millisecond') { return this.valueOf() === localInput.valueOf(); } else { inputMs = localInput.valueOf(); return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); } }
n/a
function isSameOrAfter(input, units) { return this.isSame(input, units) || this.isAfter(input,units); }
n/a
function isSameOrBefore(input, units) { return this.isSame(input, units) || this.isBefore(input,units); }
n/a
function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; }
n/a
function isUtc() { return this.isValid() ? this._isUTC && this._offset === 0 : false; }
n/a
function isUtcOffset() { return this.isValid() ? this._isUTC : false; }
n/a
function isValid$2() { return isValid(this); }
n/a
function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, 'd'); }
n/a
function getSetISOWeekYear(input) { return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4); }
n/a
function getSetISODayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } // behaves the same as moment#day except // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) // as a setter, sunday should belong to the previous week. if (input != null) { var weekday = parseIsoWeekday(input, this.localeData()); return this.day(this.day() % 7 ? weekday : weekday - 7); } else { return this.day() || 7; } }
n/a
function getSetISOWeek(input) { var week = weekOfYear(this, 1, 4).week; return input == null ? week : this.add((input - week) * 7, 'd'); }
n/a
function getISOWeeksInYear() { return weeksInYear(this.year(), 1, 4); }
n/a
lang = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function setOffsetToLocal(keepLocalTime) { if (this._isUTC) { this.utcOffset(0, keepLocalTime); this._isUTC = false; if (keepLocalTime) { this.subtract(getDateOffset(this), 'm'); } } return this; }
n/a
function locale(key) { var newLocaleData; if (key === undefined) { return this._locale._abbr; } else { newLocaleData = getLocale(key); if (newLocaleData != null) { this._locale = newLocaleData; } return this; } }
n/a
function localeData() { return this._locale; }
n/a
max = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
millisecond = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
milliseconds = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
min = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
...
return output;
}
function packBase60(number, precision) {
var output = '',
absolute = Math.abs(number),
whole = Math.floor(absolute),
fraction = packBase60Fraction(absolute - whole, Math.min(~~precision, 10));
while (whole > 0) {
output = BASE60[whole % 60] + output;
whole = Math.floor(whole / 60);
}
if (number < 0) {
...
minute = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
minutes = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
function getSetMonth(value) { if (value != null) { setMonth(this, value); hooks.updateOffset(this, true); return this; } else { return get(this, 'Month'); } }
n/a
months = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function setOffsetToParsedOffset() { if (this._tzm != null) { this.utcOffset(this._tzm, false, true); } else if (typeof this._i === 'string') { var tZone = offsetFromString(matchOffset, this._i); if (tZone != null) { this.utcOffset(tZone); } else { this.utcOffset(0, true); } } return this; }
n/a
function parsingFlags() { return extend({}, getParsingFlags(this)); }
n/a
function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); }
n/a
function getSetQuarter(input) { return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); }
n/a
second = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
seconds = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
function stringSet(units, value) { if (typeof units === 'object') { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units); for (var i = 0; i < prioritized.length; i++) { this[prioritized[i].unit](units[prioritized[i].unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; }
n/a
function startOf(units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
case 'date':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
}
// weeks are a special case
if (units === 'week') {
this.weekday(0);
}
if (units === 'isoWeek') {
this.isoWeekday(1);
}
// quarters are also special
if (units === 'quarter') {
this.month(Math.floor(this.month() / 3) * 3);
}
return this;
}
n/a
subtract = function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period ). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = createDuration(val, period); addSubtract(this, dur, direction); return this; }
n/a
function to(time, withoutSuffix) { if (this.isValid() && ((isMoment(time) && time.isValid()) || createLocal(time).isValid())) { return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); } else { return this.localeData().invalidDate(); } }
n/a
function toArray() { var m = this; return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; }
n/a
function toDate() { return new Date(this.valueOf()); }
n/a
function toISOString() { if (!this.isValid()) { return null; } var m = this.clone().utc(); if (m.year() < 0 || m.year() > 9999) { return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); } if (isFunction(Date.prototype.toISOString)) { // native implementation is ~50x faster, use it when we can return this.toDate().toISOString(); } return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); }
n/a
function toJSON() { // new Date(NaN).toJSON() === null return this.isValid() ? this.toISOString() : null; }
n/a
function toNow(withoutSuffix) { return this.to(createLocal(), withoutSuffix); }
n/a
function toObject() { var m = this; return { years: m.year(), months: m.month(), date: m.date(), hours: m.hours(), minutes: m.minutes(), seconds: m.seconds(), milliseconds: m.milliseconds() }; }
n/a
function toString() { return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); }
n/a
tz = function (name) { if (name) { this._z = getZone(name); if (this._z) { moment.updateOffset(this); } else { logError("Moment Timezone has no data for " + name + ". See http://momentjs.com/timezone/docs/#/data-loading/."); } return this; } if (this._z) { return this._z.name; } }
...
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
tz.version = VERSION;
tz.dataVersion = '';
tz._zones = zones;
...
function unix() { return Math.floor(this.valueOf() / 1000); }
n/a
utc = function () { this._z = null; return old.apply(this, arguments); }
...
moment.updateOffset = function (mom, keepTime) {
var zone = moment.defaultZone,
offset;
if (mom._z === undefined) {
if (zone && needsOffset(mom) && !mom._isUTC) {
mom._d = moment.utc(mom._a)._d;
mom.utc().add(zone.parse(mom), 'minutes');
}
mom._z = zone;
}
if (mom._z) {
offset = mom._z.offset(mom);
if (Math.abs(offset) < 16) {
...
function getSetOffset(input, keepLocalTime, keepMinutes) { var offset = this._offset || 0, localAdjust; if (!this.isValid()) { return input != null ? this : NaN; } if (input != null) { if (typeof input === 'string') { input = offsetFromString(matchShortOffset, input); if (input === null) { return this; } } else if (Math.abs(input) < 16 && !keepMinutes) { input = input * 60; } if (!this._isUTC && keepLocalTime) { localAdjust = getDateOffset(this); } this._offset = input; this._isUTC = true; if (localAdjust != null) { this.add(localAdjust, 'm'); } if (offset !== input) { if (!keepLocalTime || this._changeInProgress) { addSubtract(this, createDuration(input - offset, 'm'), 1, false); } else if (!this._changeInProgress) { this._changeInProgress = true; hooks.updateOffset(this, true); this._changeInProgress = null; } } return this; } else { return this._isUTC ? offset : getDateOffset(this); } }
...
}
if (mom._z) {
offset = mom._z.offset(mom);
if (Math.abs(offset) < 16) {
offset = offset / 60;
}
if (mom.utcOffset !== undefined) {
mom.utcOffset(-offset, keepTime);
} else {
mom.zone(offset, keepTime);
}
}
};
fn.tz = function (name) {
...
function valueOf() { return this._d.valueOf() - ((this._offset || 0) * 60000); }
n/a
function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, 'd'); }
n/a
function getSetWeekYear(input) { return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); }
n/a
function getSetLocaleDayOfWeek(input) { if (!this.isValid()) { return input != null ? this : NaN; } var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; return input == null ? weekday : this.add(input - weekday, 'd'); }
n/a
function getSetWeek(input) { var week = this.localeData().week(this); return input == null ? week : this.add((input - week) * 7, 'd'); }
n/a
function getWeeksInYear() { var weekInfo = this.localeData()._week; return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); }
n/a
year = function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }
n/a
years = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
zone = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
...
addLink(data.links);
tz.dataVersion = data.version;
}
function zoneExists (name) {
if (!zoneExists.didShowError) {
zoneExists.didShowError = true;
logError("moment.tz.zoneExists('" + name + "') has been deprecated in favor of !moment.tz.zone('" + name + "')");
}
return !!getZone(name);
}
function needsOffset (m) {
return !!(m._a && (m._tzm === undefined));
}
...
zoneAbbr = function () { if (this._z) { return this._z.abbr(this); } return old.call(this); }
n/a
zoneName = function () { if (this._z) { return this._z.abbr(this); } return old.call(this); }
n/a
function hooks() { return hookCallback.apply(null, arguments); }
n/a
ISO_8601 = function () {}
n/a
RFC_2822 = function () {}
n/a
function getCalendarFormat(myMoment, now) { var diff = myMoment.diff(now, 'days', true); return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; }
n/a
createFromInputFallback = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function defineLocale(name, config) { if (config !== null) { var parentConfig = baseConfig; config.abbr = name; if (locales[name] != null) { deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); parentConfig = locales[name]._config; } else if (config.parentLocale != null) { if (locales[config.parentLocale] != null) { parentConfig = locales[config.parentLocale]._config; } else { if (!localeFamilies[config.parentLocale]) { localeFamilies[config.parentLocale] = []; } localeFamilies[config.parentLocale].push({ name: name, config: config }); return null; } } locales[name] = new Locale(mergeConfigs(parentConfig, config)); if (localeFamilies[name]) { localeFamilies[name].forEach(function (x) { defineLocale(x.name, x.config); }); } // backwards compat for now: also set the locale // make sure we set the locale AFTER all child locales have been // created, so we won't end up with the child locale set. getSetGlobalLocale(name); return locales[name]; } else { // useful for testing delete locales[name]; return null; } }
n/a
function createDuration(input, key) { var duration = input, // matching against regexp is expensive, do it on demand match = null, sign, ret, diffRes; if (isDuration(input)) { duration = { ms : input._milliseconds, d : input._days, M : input._months }; } else if (isNumber(input)) { duration = {}; if (key) { duration[key] = input; } else { duration.milliseconds = input; } } else if (!!(match = aspNetRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : 0, d : toInt(match[DATE]) * sign, h : toInt(match[HOUR]) * sign, m : toInt(match[MINUTE]) * sign, s : toInt(match[SECOND]) * sign, ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match }; } else if (!!(match = isoRegex.exec(input))) { sign = (match[1] === '-') ? -1 : 1; duration = { y : parseIso(match[2], sign), M : parseIso(match[3], sign), w : parseIso(match[4], sign), d : parseIso(match[5], sign), h : parseIso(match[6], sign), m : parseIso(match[7], sign), s : parseIso(match[8], sign) }; } else if (duration == null) {// checks for null or undefined duration = {}; } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); duration = {}; duration.ms = diffRes.milliseconds; duration.M = diffRes.months; } ret = new Duration(duration); if (isDuration(input) && hasOwnProp(input, '_locale')) { ret._locale = input._locale; } return ret; }
n/a
function createInvalid(flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; }
n/a
function isDate(input) { return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; }
n/a
function isDuration(obj) { return obj instanceof Duration; }
n/a
function isMoment(obj) { return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); }
...
function tz (input) {
var args = Array.prototype.slice.call(arguments, 0, -1),
name = arguments[arguments.length - 1],
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
...
lang = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
langData = function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }
n/a
function getSetGlobalLocale(key, values) { var data; if (key) { if (isUndefined(values)) { data = getLocale(key); } else { data = defineLocale(key, values); } if (data) { // moment.duration._locale = moment._locale = data; globalLocale = data; } } return globalLocale._abbr; }
n/a
function getLocale(key) { var locale; if (key && key._locale && key._locale._abbr) { key = key._locale._abbr; } if (!key) { return globalLocale; } if (!isArray(key)) { //short-circuit everything else locale = loadLocale(key); if (locale) { return locale; } key = [key]; } return chooseLocale(key); }
n/a
function listLocales() { return keys$1(locales); }
n/a
function max() { var args = [].slice.call(arguments, 0); return pickBy('isAfter', args); }
n/a
function min() { var args = [].slice.call(arguments, 0); return pickBy('isBefore', args); }
...
return output;
}
function packBase60(number, precision) {
var output = '',
absolute = Math.abs(number),
whole = Math.floor(absolute),
fraction = packBase60Fraction(absolute - whole, Math.min(~~precision, 10));
while (whole > 0) {
output = BASE60[whole % 60] + output;
whole = Math.floor(whole / 60);
}
if (number < 0) {
...
function listMonths(format, index) { return listMonthsImpl(format, index, 'months'); }
n/a
function listMonthsShort(format, index) { return listMonthsImpl(format, index, 'monthsShort'); }
n/a
function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; }
n/a
now = function () { return Date.now ? Date.now() : +(new Date()); }
n/a
parseTwoDigitYear = function (input) { return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); }
n/a
function createInZone() { return createLocal.apply(null, arguments).parseZone(); }
n/a
function getSetRelativeTimeRounding(roundingFunction) { if (roundingFunction === undefined) { return round; } if (typeof(roundingFunction) === 'function') { round = roundingFunction; return true; } return false; }
n/a
function getSetRelativeTimeThreshold(threshold, limit) { if (thresholds[threshold] === undefined) { return false; } if (limit === undefined) { return thresholds[threshold]; } thresholds[threshold] = limit; if (threshold === 's') { thresholds.ss = limit - 1; } return true; }
n/a
function tz(input) { var args = Array.prototype.slice.call(arguments, 0, -1), name = arguments[arguments.length - 1], zone = getZone(name), out = moment.utc.apply(null, args); if (zone && !moment.isMoment(input) && needsOffset(out)) { out.add(zone.parse(out), 'minutes'); } out.tz(name); return out; }
...
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
tz.version = VERSION;
tz.dataVersion = '';
tz._zones = zones;
...
function createUnix(input) { return createLocal(input * 1000); }
n/a
function updateLocale(name, config) { if (config != null) { var locale, parentConfig = baseConfig; // MERGE if (locales[name] != null) { parentConfig = locales[name]._config; } config = mergeConfigs(parentConfig, config); locale = new Locale(config); locale.parentLocale = locales[name]; locales[name] = locale; // backwards compat for now: also set the locale getSetGlobalLocale(name); } else { // pass null for config to unupdate, useful for tests if (locales[name] != null) { if (locales[name].parentLocale != null) { locales[name] = locales[name].parentLocale; } else if (locales[name] != null) { delete locales[name]; } } } return locales[name]; }
n/a
updateOffset = function (mom, keepTime) { var zone = moment.defaultZone, offset; if (mom._z === undefined) { if (zone && needsOffset(mom) && !mom._isUTC) { mom._d = moment.utc(mom._a)._d; mom.utc().add(zone.parse(mom), 'minutes'); } mom._z = zone; } if (mom._z) { offset = mom._z.offset(mom); if (Math.abs(offset) < 16) { offset = offset / 60; } if (mom.utcOffset !== undefined) { mom.utcOffset(-offset, keepTime); } else { mom.zone(offset, keepTime); } } }
...
}
};
fn.tz = function (name) {
if (name) {
this._z = getZone(name);
if (this._z) {
moment.updateOffset(this);
} else {
logError("Moment Timezone has no data for " + name + ". See http://momentjs.com/timezone/docs/#/data-loading/.
x22;);
}
return this;
}
if (this._z) { return this._z.name; }
};
...
function createUTC(input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); }
...
moment.updateOffset = function (mom, keepTime) {
var zone = moment.defaultZone,
offset;
if (mom._z === undefined) {
if (zone && needsOffset(mom) && !mom._isUTC) {
mom._d = moment.utc(mom._a)._d;
mom.utc().add(zone.parse(mom), 'minutes');
}
mom._z = zone;
}
if (mom._z) {
offset = mom._z.offset(mom);
if (Math.abs(offset) < 16) {
...
function listWeekdays(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); }
n/a
function listWeekdaysMin(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); }
n/a
function listWeekdaysShort(localeSorted, format, index) { return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); }
n/a
function tz(input) { var args = Array.prototype.slice.call(arguments, 0, -1), name = arguments[arguments.length - 1], zone = getZone(name), out = moment.utc.apply(null, args); if (zone && !moment.isMoment(input) && needsOffset(out)) { out.add(zone.parse(out), 'minutes'); } out.tz(name); return out; }
...
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
tz.version = VERSION;
tz.dataVersion = '';
tz._zones = zones;
...
function Zone(packedString) { if (packedString) { this._set(unpack(packedString)); } }
n/a
function addZone(packed) { var i, name, split, normalized; if (typeof packed === "string") { packed = [packed]; } for (i = 0; i < packed.length; i++) { split = packed[i].split('|'); name = split[0]; normalized = normalizeName(name); zones[normalized] = packed[i]; names[normalized] = name; if (split[5]) { addToGuesses(normalized, split[2].split(' ')); } } }
...
function tz (input) {
var args = Array.prototype.slice.call(arguments, 0, -1),
name = arguments[arguments.length - 1],
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
...
function createLinks(source) { var zones = [], links = []; if (source.links) { links = source.links.slice(); } findAndCreateLinks(source.zones, zones, links); return { version : source.version, zones : zones, links : links.sort() }; }
n/a
function filterLinkPack(input, start, end) { var i, inputZones = input.zones, outputZones = [], output; for (i = 0; i < inputZones.length; i++) { outputZones[i] = filterYears(inputZones[i], start, end); } output = createLinks({ zones : outputZones, links : input.links.slice(), version : input.version }); for (i = 0; i < output.zones.length; i++) { output.zones[i] = pack(output.zones[i]); } return output; }
n/a
function filterYears(source, start, end) { var slice = Array.prototype.slice, indices = findStartAndEndIndex(source.untils, start, end), untils = slice.apply(source.untils, indices); untils[untils.length - 1] = null; return { name : source.name, abbrs : slice.apply(source.abbrs, indices), untils : untils, offsets : slice.apply(source.offsets, indices), population : source.population }; }
n/a
function guess(ignoreCache) { if (!cachedGuess || ignoreCache) { cachedGuess = rebuildGuess(); } return cachedGuess; }
...
### `0.5.2` _2016-03-15_
* Updated data to IANA TZDB `2016b`. [#315](https://github.com/moment/moment-timezone/pull/315)
### `0.5.1` _2016-03-01_
* Updated data to IANA TZDB `2016a`. [#299](https://github.com/moment/moment-timezone/pull/299)
* Fixed bug when `Date#toTimeString` did not return a known format. [#302](https://github.com/moment/moment-timezone/pull/302) [#
303](https://github.com/moment/moment-timezone/pull/303)
* Added lookup on `Intl.DateTimeFormat().resolvedOptions().timeZone` to `moment.tz.guess()`. [#304](https://github.com/moment/moment-timezone/pull/304) [#291](https://github.com/moment/moment-timezone/pull/291)
### `0.5.0` _2015-12-28_
* Added support for guessing the user's timezone via `moment.tz.guess()`. [#285](https://github.com/moment/moment-timezone/
pull/285)
* Fixed UMD export issue when there was an html element with `id=exports`. [#275](https://github.com/moment/moment-timezone/pull
/275)
* Removed jspm specific dependencies from `package.json`. [#284](https://github.com/moment/moment-timezone/pull/284)
### `0.4.1` _2015-10-07_
...
function addLink(aliases) { var i, alias, normal0, normal1; if (typeof aliases === "string") { aliases = [aliases]; } for (i = 0; i < aliases.length; i++) { alias = aliases[i].split('|'); normal0 = normalizeName(alias[0]); normal1 = normalizeName(alias[1]); links[normal0] = normal1; names[normal0] = alias[0]; links[normal1] = normal0; names[normal1] = alias[1]; } }
n/a
function loadData(data) { addZone(data.zones); addLink(data.links); tz.dataVersion = data.version; }
n/a
function getNames() { var i, out = []; for (i in names) { if (names.hasOwnProperty(i) && (zones[i] || zones[links[i]]) && names[i]) { out.push(names[i]); } } return out.sort(); }
n/a
function needsOffset(m) { return !!(m._a && (m._tzm === undefined)); }
n/a
function pack(source) { validatePackData(source); return [ source.name, packAbbrsAndOffsets(source), packUntils(source.untils) + packPopulation(source.population) ].join('|'); }
n/a
function packBase60(number, precision) { var output = '', absolute = Math.abs(number), whole = Math.floor(absolute), fraction = packBase60Fraction(absolute - whole, Math.min(~~precision, 10)); while (whole > 0) { output = BASE60[whole % 60] + output; whole = Math.floor(whole / 60); } if (number < 0) { output = '-' + output; } if (output && fraction) { return output + fraction; } if (!fraction && output === '-') { return '0'; } return output || fraction || '0'; }
n/a
setDefault = function (name) { if (major < 2 || (major === 2 && minor < 9)) { logError('Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js ' + moment.version + '.'); } moment.defaultZone = name ? getZone(name) : null; return moment; }
n/a
function unpack(string) { var data = string.split('|'), offsets = data[2].split(' '), indices = data[3].split(''), untils = data[4].split(' '); arrayToInt(offsets); arrayToInt(indices); arrayToInt(untils); intToUntil(untils, indices.length); return { name : data[0], abbrs : mapIndices(data[1].split(' '), indices), offsets : mapIndices(offsets, indices), untils : untils, population : data[5] | 0 }; }
n/a
function unpackBase60(string) { var i = 0, parts = string.split('.'), whole = parts[0], fractional = parts[1] || '', multiplier = 1, num, out = 0, sign = 1; // handle negative numbers if (string.charCodeAt(0) === 45) { i = 1; sign = -1; } // handle digits before the decimal for (i; i < whole.length; i++) { num = charCodeToInt(whole.charCodeAt(i)); out = 60 * out + num; } // handle digits after the decimal for (i = 0; i < fractional.length; i++) { multiplier = multiplier / 60; num = charCodeToInt(fractional.charCodeAt(i)); out += num * multiplier; } return out * sign; }
n/a
function getZone(name, caller) { name = normalizeName(name); var zone = zones[name]; var link; if (zone instanceof Zone) { return zone; } if (typeof zone === 'string') { zone = new Zone(zone); zones[name] = zone; return zone; } // Pass getZone to prevent recursion more than 1 level deep if (links[name] && caller !== getZone && (link = getZone(links[name], getZone))) { zone = zones[name] = new Zone(); zone._set(link); zone.name = names[name]; return zone; } return null; }
...
addLink(data.links);
tz.dataVersion = data.version;
}
function zoneExists (name) {
if (!zoneExists.didShowError) {
zoneExists.didShowError = true;
logError("moment.tz.zoneExists('" + name + "') has been deprecated in favor of !moment.tz.zone('" + name + "')");
}
return !!getZone(name);
}
function needsOffset (m) {
return !!(m._a && (m._tzm === undefined));
}
...
function zoneExists(name) { if (!zoneExists.didShowError) { zoneExists.didShowError = true; logError("moment.tz.zoneExists('" + name + "') has been deprecated in favor of !moment.tz.zone('" + name + "')"); } return !!getZone(name); }
...
addLink(data.links);
tz.dataVersion = data.version;
}
function zoneExists (name) {
if (!zoneExists.didShowError) {
zoneExists.didShowError = true;
logError("moment.tz.zoneExists('" + name + "') has been
deprecated in favor of !moment.tz.zone('" + name + "')");
}
return !!getZone(name);
}
function needsOffset (m) {
return !!(m._a && (m._tzm === undefined));
}
...
function Zone(packedString) { if (packedString) { this._set(unpack(packedString)); } }
n/a
_index = function (timestamp) { var target = +timestamp, untils = this.untils, i; for (i = 0; i < untils.length; i++) { if (target < untils[i]) { return i; } } }
...
}
}
return offsets[max];
},
abbr : function (mom) {
return this.abbrs[this._index(mom)];
},
offset : function (mom) {
return this.offsets[this._index(mom)];
}
};
...
_set = function (unpacked) { this.name = unpacked.name; this.abbrs = unpacked.abbrs; this.untils = unpacked.untils; this.offsets = unpacked.offsets; this.population = unpacked.population; }
...
/************************************
Zone object
************************************/
function Zone (packedString) {
if (packedString) {
this._set(unpack(packedString));
}
}
Zone.prototype = {
_set : function (unpacked) {
this.name = unpacked.name;
this.abbrs = unpacked.abbrs;
...
abbr = function (mom) { return this.abbrs[this._index(mom)]; }
...
this.zone = zone;
this.offsetScore = 0;
this.abbrScore = 0;
}
ZoneScore.prototype.scoreOffsetAt = function (offsetAt) {
this.offsetScore += Math.abs(this.zone.offset(offsetAt.at) - offsetAt.offset);
if (this.zone.abbr(offsetAt.at).replace(/[^A-Z]/g, '') !== offsetAt.abbr) {
this.abbrScore++;
}
};
function findChange(low, high) {
var mid, diff;
...
offset = function (mom) { return this.offsets[this._index(mom)]; }
...
function ZoneScore(zone) {
this.zone = zone;
this.offsetScore = 0;
this.abbrScore = 0;
}
ZoneScore.prototype.scoreOffsetAt = function (offsetAt) {
this.offsetScore += Math.abs(this.zone.offset(offsetAt.at) - offsetAt.offset);
if (this.zone.abbr(offsetAt.at).replace(/[^A-Z]/g, '') !== offsetAt.abbr) {
this.abbrScore++;
}
};
function findChange(low, high) {
var mid, diff;
...
parse = function (timestamp) { var target = +timestamp, offsets = this.offsets, untils = this.untils, max = untils.length - 1, offset, offsetNext, offsetPrev, i; for (i = 0; i < max; i++) { offset = offsets[i]; offsetNext = offsets[i + 1]; offsetPrev = offsets[i ? i - 1 : i]; if (offset < offsetNext && tz.moveAmbiguousForward) { offset = offsetNext; } else if (offset > offsetPrev && tz.moveInvalidForward) { offset = offsetPrev; } if (target < untils[i] - (offset * 60000)) { return offsets[i]; } } return offsets[max]; }
...
function tz (input) {
var args = Array.prototype.slice.call(arguments, 0, -1),
name = arguments[arguments.length - 1],
zone = getZone(name),
out = moment.utc.apply(null, args);
if (zone && !moment.isMoment(input) && needsOffset(out)) {
out.add(zone.parse(out), 'minutes');
}
out.tz(name);
return out;
}
...