Permalink
Browse files

Support two digit years

  • Loading branch information...
1 parent 1b910f6 commit 53d5779c95d6fc09dc9b603ab5ece388c9207f77 @ForbesLindesay committed Feb 26, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 index.js
View
@@ -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;

0 comments on commit 53d5779

Please sign in to comment.