Merge pull request #603 from ctantonello/master

Insert sensible defaults (1) for out.month and out.day if parsing with format string didn't set them
This commit is contained in:
Valeriy 2017-10-12 12:31:25 +05:00 committed by GitHub
commit edefba5777

View File

@ -217,7 +217,11 @@ var DateFormatter;
break; break;
} }
} }
if (vDateFlag === true && out.year && out.month && out.day) { if (vDateFlag === true) {
// Set month and day to 1 if they are null
out.month = out.month || 1;
out.day = out.day || 1;
out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0); out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0);
} else { } else {
if (vTimeFlag !== true) { if (vTimeFlag !== true) {