Insert sensible defaults (1) for out.month and out.day if parsing with format string didn't set them

See issue #550
This commit is contained in:
ctantonello 2017-09-22 14:38:22 +10:00
parent 1525c13027
commit 286bcf5178

View File

@ -217,7 +217,11 @@ var DateFormatter;
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);
} else {
if (vTimeFlag !== true) {