[GitHub] sruthakeerthikotla closed pull request #64: Updating moment.js to version 2.20.1

2018-02-02 Thread GitBox
sruthakeerthikotla closed pull request #64: Updating moment.js to version 2.20.1
URL: https://github.com/apache/cordova-plugin-globalization/pull/64
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 @@ var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 
123456789.123
 
 // 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 get (mom, unit) {
 
 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 defineLocale (name, config) {
 
 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 @@ function currentDateArray(config) {
 // 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 @@ function configFromArray (config) {
 }
 
 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 @@ function configFromArray (config) {
 }
 
 // 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 @@ function toString () {
 return this.clone().locale('en').format('ddd MMM DD  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() > ) {
-return formatMoment(m, 'YY-MM-DD[T]HH:mm:ss.SSS[Z]');
+return formatMoment(m, utc ? 'YY-MM-DD[T]HH:mm:ss.SSS[Z]' : 
'YY-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, '-MM-DD[T]HH:mm:ss.SSS[Z]');
+return formatMoment(m, utc ? '-MM-DD[T]HH:mm:ss.SSS[Z]' : 
'-MM-DD[T]HH:mm:ss.SSSZ');
 }
 
 /**
@@ -3665,7 +3673,7 @@ addRegexToken('Do', function (isStrict, locale) {
 
 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 @@ addParseToken('x', function (input, array, config) {
 // Side effect 

[GitHub] sruthakeerthikotla closed pull request #64: Updating moment.js to version 2.20.1

2018-02-02 Thread GitBox
sruthakeerthikotla closed pull request #64: Updating moment.js to version 2.20.1
URL: https://github.com/apache/cordova-plugin-globalization/pull/64
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 @@ var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 
123456789.123
 
 // 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 get (mom, unit) {
 
 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 defineLocale (name, config) {
 
 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 @@ function currentDateArray(config) {
 // 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 @@ function configFromArray (config) {
 }
 
 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 @@ function configFromArray (config) {
 }
 
 // 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 @@ function toString () {
 return this.clone().locale('en').format('ddd MMM DD  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() > ) {
-return formatMoment(m, 'YY-MM-DD[T]HH:mm:ss.SSS[Z]');
+return formatMoment(m, utc ? 'YY-MM-DD[T]HH:mm:ss.SSS[Z]' : 
'YY-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, '-MM-DD[T]HH:mm:ss.SSS[Z]');
+return formatMoment(m, utc ? '-MM-DD[T]HH:mm:ss.SSS[Z]' : 
'-MM-DD[T]HH:mm:ss.SSSZ');
 }
 
 /**
@@ -3665,7 +3673,7 @@ addRegexToken('Do', function (isStrict, locale) {
 
 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 @@ addParseToken('x', function (input, array, config) {
 // Side effect