--- a/wp/wp-includes/js/dist/vendor/moment.js Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-includes/js/dist/vendor/moment.js Fri Sep 05 18:52:52 2025 +0200
@@ -1,5 +1,5 @@
//! moment.js
-//! version : 2.29.4
+//! version : 2.30.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
@@ -155,24 +155,25 @@
}
function isValid(m) {
- if (m._isValid == null) {
- var flags = getParsingFlags(m),
- parsedParts = some.call(flags.parsedDateParts, function (i) {
- return i != null;
- }),
- isNowValid =
- !isNaN(m._d.getTime()) &&
- flags.overflow < 0 &&
- !flags.empty &&
- !flags.invalidEra &&
- !flags.invalidMonth &&
- !flags.invalidWeekday &&
- !flags.weekdayMismatch &&
- !flags.nullInput &&
- !flags.invalidFormat &&
- !flags.userInvalidated &&
- (!flags.meridiem || (flags.meridiem && parsedParts));
-
+ var flags = null,
+ parsedParts = false,
+ isNowValid = m._d && !isNaN(m._d.getTime());
+ if (isNowValid) {
+ flags = getParsingFlags(m);
+ parsedParts = some.call(flags.parsedDateParts, function (i) {
+ return i != null;
+ });
+ isNowValid =
+ flags.overflow < 0 &&
+ !flags.empty &&
+ !flags.invalidEra &&
+ !flags.invalidMonth &&
+ !flags.invalidWeekday &&
+ !flags.weekdayMismatch &&
+ !flags.nullInput &&
+ !flags.invalidFormat &&
+ !flags.userInvalidated &&
+ (!flags.meridiem || (flags.meridiem && parsedParts));
if (m._strict) {
isNowValid =
isNowValid &&
@@ -180,12 +181,11 @@
flags.unusedTokens.length === 0 &&
flags.bigHour === undefined;
}
-
- if (Object.isFrozen == null || !Object.isFrozen(m)) {
- m._isValid = isNowValid;
- } else {
- return isNowValid;
- }
+ }
+ if (Object.isFrozen == null || !Object.isFrozen(m)) {
+ m._isValid = isNowValid;
+ } else {
+ return isNowValid;
}
return m._isValid;
}
@@ -630,12 +630,56 @@
return isFunction(format) ? format(output) : format.replace(/%s/i, output);
}
- var aliases = {};
-
- function addUnitAlias(unit, shorthand) {
- var lowerCase = unit.toLowerCase();
- aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
- }
+ var aliases = {
+ D: 'date',
+ dates: 'date',
+ date: 'date',
+ d: 'day',
+ days: 'day',
+ day: 'day',
+ e: 'weekday',
+ weekdays: 'weekday',
+ weekday: 'weekday',
+ E: 'isoWeekday',
+ isoweekdays: 'isoWeekday',
+ isoweekday: 'isoWeekday',
+ DDD: 'dayOfYear',
+ dayofyears: 'dayOfYear',
+ dayofyear: 'dayOfYear',
+ h: 'hour',
+ hours: 'hour',
+ hour: 'hour',
+ ms: 'millisecond',
+ milliseconds: 'millisecond',
+ millisecond: 'millisecond',
+ m: 'minute',
+ minutes: 'minute',
+ minute: 'minute',
+ M: 'month',
+ months: 'month',
+ month: 'month',
+ Q: 'quarter',
+ quarters: 'quarter',
+ quarter: 'quarter',
+ s: 'second',
+ seconds: 'second',
+ second: 'second',
+ gg: 'weekYear',
+ weekyears: 'weekYear',
+ weekyear: 'weekYear',
+ GG: 'isoWeekYear',
+ isoweekyears: 'isoWeekYear',
+ isoweekyear: 'isoWeekYear',
+ w: 'week',
+ weeks: 'week',
+ week: 'week',
+ W: 'isoWeek',
+ isoweeks: 'isoWeek',
+ isoweek: 'isoWeek',
+ y: 'year',
+ years: 'year',
+ year: 'year',
+ };
function normalizeUnits(units) {
return typeof units === 'string'
@@ -660,11 +704,24 @@
return normalizedInput;
}
- var priorities = {};
-
- function addUnitPriority(unit, priority) {
- priorities[unit] = priority;
- }
+ var priorities = {
+ date: 9,
+ day: 11,
+ weekday: 11,
+ isoWeekday: 11,
+ dayOfYear: 4,
+ hour: 13,
+ millisecond: 16,
+ minute: 14,
+ month: 8,
+ quarter: 7,
+ second: 15,
+ weekYear: 1,
+ isoWeekYear: 1,
+ week: 5,
+ isoWeek: 5,
+ year: 1,
+ };
function getPrioritizedUnits(unitsObj) {
var units = [],
@@ -680,96 +737,6 @@
return units;
}
- function isLeapYear(year) {
- return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
- }
-
- function absFloor(number) {
- if (number < 0) {
- // -0 -> 0
- return Math.ceil(number) || 0;
- } else {
- return Math.floor(number);
- }
- }
-
- function toInt(argumentForCoercion) {
- var coercedNumber = +argumentForCoercion,
- value = 0;
-
- if (coercedNumber !== 0 && isFinite(coercedNumber)) {
- value = absFloor(coercedNumber);
- }
-
- return value;
- }
-
- function makeGetSet(unit, keepTime) {
- return function (value) {
- if (value != null) {
- set$1(this, unit, value);
- hooks.updateOffset(this, keepTime);
- return this;
- } else {
- return get(this, unit);
- }
- };
- }
-
- function get(mom, unit) {
- return mom.isValid()
- ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
- : NaN;
- }
-
- function set$1(mom, unit, value) {
- if (mom.isValid() && !isNaN(value)) {
- if (
- unit === 'FullYear' &&
- isLeapYear(mom.year()) &&
- mom.month() === 1 &&
- mom.date() === 29
- ) {
- value = toInt(value);
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
- value,
- mom.month(),
- daysInMonth(value, mom.month())
- );
- } else {
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
- }
- }
- }
-
- // MOMENTS
-
- function stringGet(units) {
- units = normalizeUnits(units);
- if (isFunction(this[units])) {
- return this[units]();
- }
- return this;
- }
-
- function stringSet(units, value) {
- if (typeof units === 'object') {
- units = normalizeObjectUnits(units);
- var prioritized = getPrioritizedUnits(units),
- i,
- prioritizedLen = prioritized.length;
- for (i = 0; i < prioritizedLen; i++) {
- this[prioritized[i].unit](units[prioritized[i].unit]);
- }
- } else {
- units = normalizeUnits(units);
- if (isFunction(this[units])) {
- return this[units](value);
- }
- }
- return this;
- }
-
var match1 = /\d/, // 0 - 9
match2 = /\d\d/, // 00 - 99
match3 = /\d{3}/, // 000 - 999
@@ -790,6 +757,8 @@
// includes scottish gaelic two word and hyphenated months
matchWord =
/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
+ match1to2NoLeadingZero = /^[1-9]\d?/, // 1-99
+ match1to2HasZero = /^([1-9]\d|\d)/, // 0-99
regexes;
regexes = {};
@@ -828,6 +797,26 @@
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
+ function absFloor(number) {
+ if (number < 0) {
+ // -0 -> 0
+ return Math.ceil(number) || 0;
+ } else {
+ return Math.floor(number);
+ }
+ }
+
+ function toInt(argumentForCoercion) {
+ var coercedNumber = +argumentForCoercion,
+ value = 0;
+
+ if (coercedNumber !== 0 && isFinite(coercedNumber)) {
+ value = absFloor(coercedNumber);
+ }
+
+ return value;
+ }
+
var tokens = {};
function addParseToken(token, callback) {
@@ -861,6 +850,10 @@
}
}
+ function isLeapYear(year) {
+ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
+ }
+
var YEAR = 0,
MONTH = 1,
DATE = 2,
@@ -871,6 +864,173 @@
WEEK = 7,
WEEKDAY = 8;
+ // FORMATTING
+
+ addFormatToken('Y', 0, 0, function () {
+ var y = this.year();
+ return y <= 9999 ? zeroFill(y, 4) : '+' + y;
+ });
+
+ addFormatToken(0, ['YY', 2], 0, function () {
+ return this.year() % 100;
+ });
+
+ addFormatToken(0, ['YYYY', 4], 0, 'year');
+ addFormatToken(0, ['YYYYY', 5], 0, 'year');
+ addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
+
+ // PARSING
+
+ addRegexToken('Y', matchSigned);
+ addRegexToken('YY', match1to2, match2);
+ addRegexToken('YYYY', match1to4, match4);
+ addRegexToken('YYYYY', match1to6, match6);
+ addRegexToken('YYYYYY', match1to6, match6);
+
+ addParseToken(['YYYYY', 'YYYYYY'], YEAR);
+ addParseToken('YYYY', function (input, array) {
+ array[YEAR] =
+ input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
+ });
+ addParseToken('YY', function (input, array) {
+ array[YEAR] = hooks.parseTwoDigitYear(input);
+ });
+ addParseToken('Y', function (input, array) {
+ array[YEAR] = parseInt(input, 10);
+ });
+
+ // HELPERS
+
+ function daysInYear(year) {
+ return isLeapYear(year) ? 366 : 365;
+ }
+
+ // HOOKS
+
+ hooks.parseTwoDigitYear = function (input) {
+ return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
+ };
+
+ // MOMENTS
+
+ var getSetYear = makeGetSet('FullYear', true);
+
+ function getIsLeapYear() {
+ return isLeapYear(this.year());
+ }
+
+ function makeGetSet(unit, keepTime) {
+ return function (value) {
+ if (value != null) {
+ set$1(this, unit, value);
+ hooks.updateOffset(this, keepTime);
+ return this;
+ } else {
+ return get(this, unit);
+ }
+ };
+ }
+
+ function get(mom, unit) {
+ if (!mom.isValid()) {
+ return NaN;
+ }
+
+ var d = mom._d,
+ isUTC = mom._isUTC;
+
+ switch (unit) {
+ case 'Milliseconds':
+ return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
+ case 'Seconds':
+ return isUTC ? d.getUTCSeconds() : d.getSeconds();
+ case 'Minutes':
+ return isUTC ? d.getUTCMinutes() : d.getMinutes();
+ case 'Hours':
+ return isUTC ? d.getUTCHours() : d.getHours();
+ case 'Date':
+ return isUTC ? d.getUTCDate() : d.getDate();
+ case 'Day':
+ return isUTC ? d.getUTCDay() : d.getDay();
+ case 'Month':
+ return isUTC ? d.getUTCMonth() : d.getMonth();
+ case 'FullYear':
+ return isUTC ? d.getUTCFullYear() : d.getFullYear();
+ default:
+ return NaN; // Just in case
+ }
+ }
+
+ function set$1(mom, unit, value) {
+ var d, isUTC, year, month, date;
+
+ if (!mom.isValid() || isNaN(value)) {
+ return;
+ }
+
+ d = mom._d;
+ isUTC = mom._isUTC;
+
+ switch (unit) {
+ case 'Milliseconds':
+ return void (isUTC
+ ? d.setUTCMilliseconds(value)
+ : d.setMilliseconds(value));
+ case 'Seconds':
+ return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
+ case 'Minutes':
+ return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
+ case 'Hours':
+ return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
+ case 'Date':
+ return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
+ // case 'Day': // Not real
+ // return void (isUTC ? d.setUTCDay(value) : d.setDay(value));
+ // case 'Month': // Not used because we need to pass two variables
+ // return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));
+ case 'FullYear':
+ break; // See below ...
+ default:
+ return; // Just in case
+ }
+
+ year = value;
+ month = mom.month();
+ date = mom.date();
+ date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
+ void (isUTC
+ ? d.setUTCFullYear(year, month, date)
+ : d.setFullYear(year, month, date));
+ }
+
+ // MOMENTS
+
+ function stringGet(units) {
+ units = normalizeUnits(units);
+ if (isFunction(this[units])) {
+ return this[units]();
+ }
+ return this;
+ }
+
+ function stringSet(units, value) {
+ if (typeof units === 'object') {
+ units = normalizeObjectUnits(units);
+ var prioritized = getPrioritizedUnits(units),
+ i,
+ prioritizedLen = prioritized.length;
+ for (i = 0; i < prioritizedLen; i++) {
+ this[prioritized[i].unit](units[prioritized[i].unit]);
+ }
+ } else {
+ units = normalizeUnits(units);
+ if (isFunction(this[units])) {
+ return this[units](value);
+ }
+ }
+ return this;
+ }
+
function mod(n, x) {
return ((n % x) + x) % x;
}
@@ -919,17 +1079,9 @@
return this.localeData().months(this, format);
});
- // ALIASES
-
- addUnitAlias('month', 'M');
-
- // PRIORITY
-
- addUnitPriority('month', 8);
-
// PARSING
- addRegexToken('M', match1to2);
+ addRegexToken('M', match1to2, match1to2NoLeadingZero);
addRegexToken('MM', match1to2, match2);
addRegexToken('MMM', function (isStrict, locale) {
return locale.monthsShortRegex(isStrict);
@@ -1095,8 +1247,6 @@
// MOMENTS
function setMonth(mom, value) {
- var dayOfMonth;
-
if (!mom.isValid()) {
// No op
return mom;
@@ -1114,8 +1264,13 @@
}
}
- dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
+ var month = value,
+ date = mom.date();
+
+ date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
+ void (mom._isUTC
+ ? mom._d.setUTCMonth(month, date)
+ : mom._d.setMonth(month, date));
return mom;
}
@@ -1182,27 +1337,24 @@
longPieces = [],
mixedPieces = [],
i,
- mom;
+ mom,
+ shortP,
+ longP;
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, i]);
- shortPieces.push(this.monthsShort(mom, ''));
- longPieces.push(this.months(mom, ''));
- mixedPieces.push(this.months(mom, ''));
- mixedPieces.push(this.monthsShort(mom, ''));
+ shortP = regexEscape(this.monthsShort(mom, ''));
+ longP = regexEscape(this.months(mom, ''));
+ shortPieces.push(shortP);
+ longPieces.push(longP);
+ mixedPieces.push(longP);
+ mixedPieces.push(shortP);
}
// Sorting makes sure if one month (or abbr) is a prefix of another it
// will match the longer piece.
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
- for (i = 0; i < 12; i++) {
- shortPieces[i] = regexEscape(shortPieces[i]);
- longPieces[i] = regexEscape(longPieces[i]);
- }
- for (i = 0; i < 24; i++) {
- mixedPieces[i] = regexEscape(mixedPieces[i]);
- }
this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._monthsShortRegex = this._monthsRegex;
@@ -1216,69 +1368,6 @@
);
}
- // FORMATTING
-
- addFormatToken('Y', 0, 0, function () {
- var y = this.year();
- return y <= 9999 ? zeroFill(y, 4) : '+' + y;
- });
-
- addFormatToken(0, ['YY', 2], 0, function () {
- return this.year() % 100;
- });
-
- addFormatToken(0, ['YYYY', 4], 0, 'year');
- addFormatToken(0, ['YYYYY', 5], 0, 'year');
- addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
-
- // ALIASES
-
- addUnitAlias('year', 'y');
-
- // PRIORITIES
-
- addUnitPriority('year', 1);
-
- // PARSING
-
- addRegexToken('Y', matchSigned);
- addRegexToken('YY', match1to2, match2);
- addRegexToken('YYYY', match1to4, match4);
- addRegexToken('YYYYY', match1to6, match6);
- addRegexToken('YYYYYY', match1to6, match6);
-
- addParseToken(['YYYYY', 'YYYYYY'], YEAR);
- addParseToken('YYYY', function (input, array) {
- array[YEAR] =
- input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
- });
- addParseToken('YY', function (input, array) {
- array[YEAR] = hooks.parseTwoDigitYear(input);
- });
- addParseToken('Y', function (input, array) {
- array[YEAR] = parseInt(input, 10);
- });
-
- // HELPERS
-
- function daysInYear(year) {
- return isLeapYear(year) ? 366 : 365;
- }
-
- // HOOKS
-
- hooks.parseTwoDigitYear = function (input) {
- return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
- };
-
- // MOMENTS
-
- var getSetYear = makeGetSet('FullYear', true);
-
- function getIsLeapYear() {
- return isLeapYear(this.year());
- }
-
function createDate(y, m, d, h, M, s, ms) {
// can't just apply() to create a date:
// https://stackoverflow.com/q/181348
@@ -1384,21 +1473,11 @@
addFormatToken('w', ['ww', 2], 'wo', 'week');
addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
- // ALIASES
-
- addUnitAlias('week', 'w');
- addUnitAlias('isoWeek', 'W');
-
- // PRIORITIES
-
- addUnitPriority('week', 5);
- addUnitPriority('isoWeek', 5);
-
// PARSING
- addRegexToken('w', match1to2);
+ addRegexToken('w', match1to2, match1to2NoLeadingZero);
addRegexToken('ww', match1to2, match2);
- addRegexToken('W', match1to2);
+ addRegexToken('W', match1to2, match1to2NoLeadingZero);
addRegexToken('WW', match1to2, match2);
addWeekParseToken(
@@ -1460,17 +1539,6 @@
addFormatToken('e', 0, 0, 'weekday');
addFormatToken('E', 0, 0, 'isoWeekday');
- // ALIASES
-
- addUnitAlias('day', 'd');
- addUnitAlias('weekday', 'e');
- addUnitAlias('isoWeekday', 'E');
-
- // PRIORITY
- addUnitPriority('day', 11);
- addUnitPriority('weekday', 11);
- addUnitPriority('isoWeekday', 11);
-
// PARSING
addRegexToken('d', match1to2);
@@ -1550,24 +1618,24 @@
return m === true
? shiftWeekdays(weekdays, this._week.dow)
: m
- ? weekdays[m.day()]
- : weekdays;
+ ? weekdays[m.day()]
+ : weekdays;
}
function localeWeekdaysShort(m) {
return m === true
? shiftWeekdays(this._weekdaysShort, this._week.dow)
: m
- ? this._weekdaysShort[m.day()]
- : this._weekdaysShort;
+ ? this._weekdaysShort[m.day()]
+ : this._weekdaysShort;
}
function localeWeekdaysMin(m) {
return m === true
? shiftWeekdays(this._weekdaysMin, this._week.dow)
: m
- ? this._weekdaysMin[m.day()]
- : this._weekdaysMin;
+ ? this._weekdaysMin[m.day()]
+ : this._weekdaysMin;
}
function handleStrictParse$1(weekdayName, format, strict) {
@@ -1716,7 +1784,8 @@
if (!this.isValid()) {
return input != null ? this : NaN;
}
- var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
+
+ var day = get(this, 'Day');
if (input != null) {
input = parseWeekday(input, this.localeData());
return this.add(input - day, 'd');
@@ -1915,13 +1984,6 @@
meridiem('a', true);
meridiem('A', false);
- // ALIASES
-
- addUnitAlias('hour', 'h');
-
- // PRIORITY
- addUnitPriority('hour', 13);
-
// PARSING
function matchMeridiem(isStrict, locale) {
@@ -1930,9 +1992,9 @@
addRegexToken('a', matchMeridiem);
addRegexToken('A', matchMeridiem);
- addRegexToken('H', match1to2);
- addRegexToken('h', match1to2);
- addRegexToken('k', match1to2);
+ addRegexToken('H', match1to2, match1to2HasZero);
+ addRegexToken('h', match1to2, match1to2NoLeadingZero);
+ addRegexToken('k', match1to2, match1to2NoLeadingZero);
addRegexToken('HH', match1to2, match2);
addRegexToken('hh', match1to2, match2);
addRegexToken('kk', match1to2, match2);
@@ -2082,7 +2144,8 @@
function isLocaleNameSane(name) {
// Prevent names that look like filesystem paths, i.e contain '/' or '\'
- return name.match('^[^/\\\\]*$') != null;
+ // Ensure name is available and function returns boolean
+ return !!(name && name.match('^[^/\\\\]*$'));
}
function loadLocale(name) {
@@ -2274,21 +2337,21 @@
a[MONTH] < 0 || a[MONTH] > 11
? MONTH
: a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
- ? DATE
- : a[HOUR] < 0 ||
- a[HOUR] > 24 ||
- (a[HOUR] === 24 &&
- (a[MINUTE] !== 0 ||
- a[SECOND] !== 0 ||
- a[MILLISECOND] !== 0))
- ? HOUR
- : a[MINUTE] < 0 || a[MINUTE] > 59
- ? MINUTE
- : a[SECOND] < 0 || a[SECOND] > 59
- ? SECOND
- : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
- ? MILLISECOND
- : -1;
+ ? DATE
+ : a[HOUR] < 0 ||
+ a[HOUR] > 24 ||
+ (a[HOUR] === 24 &&
+ (a[MINUTE] !== 0 ||
+ a[SECOND] !== 0 ||
+ a[MILLISECOND] !== 0))
+ ? HOUR
+ : a[MINUTE] < 0 || a[MINUTE] > 59
+ ? MINUTE
+ : a[SECOND] < 0 || a[SECOND] > 59
+ ? SECOND
+ : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
+ ? MILLISECOND
+ : -1;
if (
getParsingFlags(m)._overflowDayOfYear &&
@@ -3729,16 +3792,16 @@
return diff < -6
? 'sameElse'
: diff < -1
- ? 'lastWeek'
- : diff < 0
- ? 'lastDay'
- : diff < 1
- ? 'sameDay'
- : diff < 2
- ? 'nextDay'
- : diff < 7
- ? 'nextWeek'
- : 'sameElse';
+ ? 'lastWeek'
+ : diff < 0
+ ? 'lastDay'
+ : diff < 1
+ ? 'sameDay'
+ : diff < 2
+ ? 'nextDay'
+ : diff < 7
+ ? 'nextWeek'
+ : 'sameElse';
}
function calendar$1(time, formats) {
@@ -4546,16 +4609,22 @@
mixedPieces = [],
i,
l,
+ erasName,
+ erasAbbr,
+ erasNarrow,
eras = this.eras();
for (i = 0, l = eras.length; i < l; ++i) {
- namePieces.push(regexEscape(eras[i].name));
- abbrPieces.push(regexEscape(eras[i].abbr));
- narrowPieces.push(regexEscape(eras[i].narrow));
-
- mixedPieces.push(regexEscape(eras[i].name));
- mixedPieces.push(regexEscape(eras[i].abbr));
- mixedPieces.push(regexEscape(eras[i].narrow));
+ erasName = regexEscape(eras[i].name);
+ erasAbbr = regexEscape(eras[i].abbr);
+ erasNarrow = regexEscape(eras[i].narrow);
+
+ namePieces.push(erasName);
+ abbrPieces.push(erasAbbr);
+ narrowPieces.push(erasNarrow);
+ mixedPieces.push(erasName);
+ mixedPieces.push(erasAbbr);
+ mixedPieces.push(erasNarrow);
}
this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
@@ -4588,14 +4657,6 @@
// ALIASES
- addUnitAlias('weekYear', 'gg');
- addUnitAlias('isoWeekYear', 'GG');
-
- // PRIORITY
-
- addUnitPriority('weekYear', 1);
- addUnitPriority('isoWeekYear', 1);
-
// PARSING
addRegexToken('G', matchSigned);
@@ -4625,7 +4686,7 @@
this,
input,
this.week(),
- this.weekday(),
+ this.weekday() + this.localeData()._week.dow,
this.localeData()._week.dow,
this.localeData()._week.doy
);
@@ -4687,14 +4748,6 @@
addFormatToken('Q', 0, 'Qo', 'quarter');
- // ALIASES
-
- addUnitAlias('quarter', 'Q');
-
- // PRIORITY
-
- addUnitPriority('quarter', 7);
-
// PARSING
addRegexToken('Q', match1);
@@ -4714,16 +4767,9 @@
addFormatToken('D', ['DD', 2], 'Do', 'date');
- // ALIASES
-
- addUnitAlias('date', 'D');
-
- // PRIORITY
- addUnitPriority('date', 9);
-
// PARSING
- addRegexToken('D', match1to2);
+ addRegexToken('D', match1to2, match1to2NoLeadingZero);
addRegexToken('DD', match1to2, match2);
addRegexToken('Do', function (isStrict, locale) {
// TODO: Remove "ordinalParse" fallback in next major release.
@@ -4745,13 +4791,6 @@
addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
- // ALIASES
-
- addUnitAlias('dayOfYear', 'DDD');
-
- // PRIORITY
- addUnitPriority('dayOfYear', 4);
-
// PARSING
addRegexToken('DDD', match1to3);
@@ -4776,17 +4815,9 @@
addFormatToken('m', ['mm', 2], 0, 'minute');
- // ALIASES
-
- addUnitAlias('minute', 'm');
-
- // PRIORITY
-
- addUnitPriority('minute', 14);
-
// PARSING
- addRegexToken('m', match1to2);
+ addRegexToken('m', match1to2, match1to2HasZero);
addRegexToken('mm', match1to2, match2);
addParseToken(['m', 'mm'], MINUTE);
@@ -4798,17 +4829,9 @@
addFormatToken('s', ['ss', 2], 0, 'second');
- // ALIASES
-
- addUnitAlias('second', 's');
-
- // PRIORITY
-
- addUnitPriority('second', 15);
-
// PARSING
- addRegexToken('s', match1to2);
+ addRegexToken('s', match1to2, match1to2HasZero);
addRegexToken('ss', match1to2, match2);
addParseToken(['s', 'ss'], SECOND);
@@ -4846,14 +4869,6 @@
return this.millisecond() * 1000000;
});
- // ALIASES
-
- addUnitAlias('millisecond', 'ms');
-
- // PRIORITY
-
- addUnitPriority('millisecond', 16);
-
// PARSING
addRegexToken('S', match1to3, match1);
@@ -5161,12 +5176,12 @@
toInt((number % 100) / 10) === 1
? 'th'
: b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
+ ? 'st'
+ : b === 2
+ ? 'nd'
+ : b === 3
+ ? 'rd'
+ : 'th';
return number + output;
},
});
@@ -5339,19 +5354,6 @@
}
}
- // TODO: Use this.as('ms')?
- function valueOf$1() {
- if (!this.isValid()) {
- return NaN;
- }
- return (
- this._milliseconds +
- this._days * 864e5 +
- (this._months % 12) * 2592e6 +
- toInt(this._months / 12) * 31536e6
- );
- }
-
function makeAs(alias) {
return function () {
return this.as(alias);
@@ -5366,7 +5368,8 @@
asWeeks = makeAs('w'),
asMonths = makeAs('M'),
asQuarters = makeAs('Q'),
- asYears = makeAs('y');
+ asYears = makeAs('y'),
+ valueOf$1 = asMilliseconds;
function clone$1() {
return createDuration(this);
@@ -5635,7 +5638,7 @@
//! moment.js
- hooks.version = '2.29.4';
+ hooks.version = '2.30.1';
setHookCallback(createLocal);