From 0c11c7ebd83fb67d1d464e8d676dc31c80d9c53f Mon Sep 17 00:00:00 2001 From: Matti Salokangas Date: Fri, 25 Sep 2020 16:37:44 -0700 Subject: [PATCH] Only call localCheck when time is involved --- lib/date.js | 5 +---- test/tests/locales/fi.js | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/date.js b/lib/date.js index 506a2138b..3e4f3595d 100644 --- a/lib/date.js +++ b/lib/date.js @@ -2477,15 +2477,12 @@ function getNewLocale(def) { function addCoreFormats() { forEach(CoreParsingFormats, function(df) { var src = df.src; - if (df.localeCheck && !df.localeCheck(loc)) { - return; - } if (df.mdy && loc.mdy) { // Use the mm/dd/yyyy variant if it // exists and the locale requires it src = df.mdy; } - if (df.time) { + if (df.time && !df.localeCheck || (df.localeCheck && !df.localeCheck(loc))) { // Core formats that allow time require the time // reg on both sides, so add both versions here. loc.addFormat(getFormatWithTime(src, true)); diff --git a/test/tests/locales/fi.js b/test/tests/locales/fi.js index 30ac8390e..1f5543357 100644 --- a/test/tests/locales/fi.js +++ b/test/tests/locales/fi.js @@ -11,6 +11,7 @@ namespace('Date | Finnish', function () { method('create', function() { + assertDateParsed('1.12.2019', new Date(2019, 11, 1)); assertDateParsed('15. toukokuuta 2011', new Date(2011, 4, 15)); assertDateParsed('torstai 5. tammikuuta 2012', new Date(2012, 0, 5)); assertDateParsed('torstaina 5. tammikuuta 2012', new Date(2012, 0, 5));