From: Matthew Kendrick Co Date: Sun, 17 Dec 2017 00:37:43 +0000 (+0800) Subject: [bugfix] Fix incorrect strict parsing with full-width parentheses (#4240) X-Git-Tag: 2.20.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=666a92fdd244c8fa3aeeabd816fab9f0d4fff73b;p=thirdparty%2Fmoment.git [bugfix] Fix incorrect strict parsing with full-width parentheses (#4240) --- diff --git a/src/lib/parse/regex.js b/src/lib/parse/regex.js index 5076548ed..4b86f34c7 100644 --- a/src/lib/parse/regex.js +++ b/src/lib/parse/regex.js @@ -20,7 +20,7 @@ export 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 -export var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; +export 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; import hasOwnProp from '../utils/has-own-prop'; diff --git a/src/test/locale/ja.js b/src/test/locale/ja.js index 2435e13a1..f9d184a2a 100644 --- a/src/test/locale/ja.js +++ b/src/test/locale/ja.js @@ -170,3 +170,6 @@ test('weeks year starting sunday format', function (assert) { assert.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3', 'Jan 15 2012 should be week 3'); }); +test('parse with japanese parentheses', function (assert) { + assert.ok(moment('2016年5月18日(水)', 'YYYY年M月D日(dd)', true).isValid(), 'parse with japanese parentheses'); +});