res.months = other.month() - base.month() +
(other.year() - base.year()) * 12;
if (base.clone().add(res.months, 'M').isAfter(other)) {
- -- res.months;
+ --res.months;
}
res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
res = positiveMomentsDifference(base, other);
} else {
res = positiveMomentsDifference(other, base);
- res.milliseconds = - res.milliseconds;
- res.months = - res.months;
+ res.milliseconds = -res.milliseconds;
+ res.months = -res.months;
}
return res;
}
function isDate(input) {
- return Object.prototype.toString.call(input) === '[object Date]' ||
- input instanceof Date;
+ return Object.prototype.toString.call(input) === '[object Date]' ||
+ input instanceof Date;
}
// compare two arrays, return the number of differences
case 'ggggg':
return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;
case 'S':
- if (strict) { return parseTokenOneDigit; }
+ if (strict) {
+ return parseTokenOneDigit;
+ }
/* falls through */
case 'SS':
- if (strict) { return parseTokenTwoDigits; }
+ if (strict) {
+ return parseTokenTwoDigits;
+ }
/* falls through */
case 'SSS':
- if (strict) { return parseTokenThreeDigits; }
+ if (strict) {
+ return parseTokenThreeDigits;
+ }
/* falls through */
case 'DDD':
return parseTokenOneToThreeDigits;
moment.suppressDeprecationWarnings = false;
moment.createFromInputFallback = deprecate(
- "moment construction falls back to js Date. This is " +
- "discouraged and will be removed in upcoming major " +
- "release. Please refer to " +
- "https://github.com/moment/moment/issues/1407 for more info.",
- function (config) {
- config._d = new Date(config._i);
- });
+ "moment construction falls back to js Date. This is " +
+ "discouraged and will be removed in upcoming major " +
+ "release. Please refer to " +
+ "https://github.com/moment/moment/issues/1407 for more info.",
+ function (config) {
+ config._d = new Date(config._i);
+ }
+ );
// Pick a moment m from moments so that m[fn](other) is true for all
// other. This relies on the function fn to be transitive.
moment.updateOffset = function () {};
// This function allows you to set a threshold for relative time strings
- moment.relativeTimeThreshold = function(threshold, limit) {
- if (relativeTimeThresholds[threshold] === undefined) {
- return false;
- }
-
- if(limit === undefined){
- return relativeTimeThresholds[threshold];
- }
-
- relativeTimeThresholds[threshold] = limit;
- return true;
+ moment.relativeTimeThreshold = function (threshold, limit) {
+ if (relativeTimeThresholds[threshold] === undefined) {
+ return false;
+ }
+ if (limit === undefined) {
+ return relativeTimeThresholds[threshold];
+ }
+ relativeTimeThresholds[threshold] = limit;
+ return true;
};
// This function will load languages and then set the global language. If
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
if (input != null) {
input = parseWeekday(input, this.lang());
- return this.add({ d : input - day });
+ return this.add(input - day, 'days');
} else {
return day;
}
}
}
- moment.duration.fn.asMilliseconds = function () { return this.as('ms'); };
- moment.duration.fn.asSeconds = function () { return this.as('s'); };
- moment.duration.fn.asMinutes = function () { return this.as('m'); };
- moment.duration.fn.asHours = function () { return this.as('h'); };
- moment.duration.fn.asDays = function () { return this.as('d'); };
- moment.duration.fn.asWeeks = function () { return this.as('weeks'); };
- moment.duration.fn.asMonths = function () { return this.as('M'); };
- moment.duration.fn.asYears = function () { return this.as('y'); };
+ moment.duration.fn.asMilliseconds = function () {
+ return this.as('ms');
+ };
+ moment.duration.fn.asSeconds = function () {
+ return this.as('s');
+ };
+ moment.duration.fn.asMinutes = function () {
+ return this.as('m');
+ };
+ moment.duration.fn.asHours = function () {
+ return this.as('h');
+ };
+ moment.duration.fn.asDays = function () {
+ return this.as('d');
+ };
+ moment.duration.fn.asWeeks = function () {
+ return this.as('weeks');
+ };
+ moment.duration.fn.asMonths = function () {
+ return this.as('M');
+ };
+ moment.duration.fn.asYears = function () {
+ return this.as('y');
+ };
/************************************
Default Lang