Updating moment.js to version 2.20.1 (#64)
diff --git a/www/browser/moment.js b/www/browser/moment.js
index 1704b2a..9428c66 100644
--- a/www/browser/moment.js
+++ b/www/browser/moment.js
@@ -1,5 +1,5 @@
//! moment.js
-//! version : 2.19.1
+//! version : 2.20.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
@@ -659,7 +659,7 @@
// any word (or two) characters or numbers including two/three word month in arabic.
// includes scottish gaelic two word and hyphenated months
-var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
+var 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;
var regexes = {};
@@ -814,7 +814,7 @@
function set$1 (mom, unit, value) {
if (mom.isValid() && !isNaN(value)) {
- if (unit === 'FullYear' && isLeapYear(mom.year())) {
+ if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
}
else {
@@ -1920,10 +1920,11 @@
function updateLocale(name, config) {
if (config != null) {
- var locale, parentConfig = baseConfig;
+ var locale, tmpLocale, parentConfig = baseConfig;
// MERGE
- if (locales[name] != null) {
- parentConfig = locales[name]._config;
+ tmpLocale = loadLocale(name);
+ if (tmpLocale != null) {
+ parentConfig = tmpLocale._config;
}
config = mergeConfigs(parentConfig, config);
locale = new Locale(config);
@@ -2028,7 +2029,7 @@
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) {
- var i, date, input = [], currentDate, yearToUse;
+ var i, date, input = [], currentDate, expectedWeekday, yearToUse;
if (config._d) {
return;
@@ -2078,6 +2079,8 @@
}
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
+ expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
+
// Apply timezone offset from input. The actual utcOffset can be changed
// with parseZone.
if (config._tzm != null) {
@@ -2089,7 +2092,7 @@
}
// check for mismatching day of week
- if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== config._d.getDay()) {
+ if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
getParsingFlags(config).weekdayMismatch = true;
}
}
@@ -3297,19 +3300,24 @@
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
}
-function toISOString() {
+function toISOString(keepOffset) {
if (!this.isValid()) {
return null;
}
- var m = this.clone().utc();
+ var utc = keepOffset !== true;
+ var m = utc ? this.clone().utc() : this;
if (m.year() < 0 || m.year() > 9999) {
- return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
}
if (isFunction(Date.prototype.toISOString)) {
// native implementation is ~50x faster, use it when we can
- return this.toDate().toISOString();
+ if (utc) {
+ return this.toDate().toISOString();
+ } else {
+ return new Date(this._d.valueOf()).toISOString().replace('Z', formatMoment(m, 'Z'));
+ }
}
- return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
+ return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
}
/**
@@ -3665,7 +3673,7 @@
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
- array[DATE] = toInt(input.match(match1to2)[0], 10);
+ array[DATE] = toInt(input.match(match1to2)[0]);
});
// MOMENTS
@@ -4477,7 +4485,7 @@
// Side effect imports
-hooks.version = '2.19.1';
+hooks.version = '2.20.1';
setHookCallback(createLocal);
@@ -4509,6 +4517,19 @@
hooks.calendarFormat = getCalendarFormat;
hooks.prototype = proto;
+// currently HTML5 input type only supports 24-hour formats
+hooks.HTML5_FMT = {
+ DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
+ DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
+ DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
+ DATE: 'YYYY-MM-DD', // <input type="date" />
+ TIME: 'HH:mm', // <input type="time" />
+ TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
+ TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
+ WEEK: 'YYYY-[W]WW', // <input type="week" />
+ MONTH: 'YYYY-MM' // <input type="month" />
+};
+
return hooks;
})));