Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support two digit years

  • Loading branch information...
commit 53d5779c95d6fc09dc9b603ab5ece388c9207f77 1 parent 1b910f6
@ForbesLindesay authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 index.js
View
4 index.js
@@ -15,6 +15,7 @@ exports = module.exports = function parse(str, usa) {
return parseNearbyDays(str, now) ||
parseLastThisNext(str, now) ||
parseNumberDate(str, usa) ||
+ parseNumberDateShortYear(str, usa, 80) ||
parseWordyDate(str, now) ||
parseIso8601Date(str);
};
@@ -111,6 +112,9 @@ function parseWordyDateParts(rawDay, rawMonth, rawYear, today) {
else
year = today.getFullYear();
+ if (year < 100 && year >= 80) year += 1900;
+ if (year < 100) year += 2000;
+
if (!(day && month !== null && year))
return null;
Please sign in to comment.
Something went wrong with that request. Please try again.