nazar-pc / PickMeUp

Really simple, powerful, customizable and lightweight standalone datepicker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disambiguation of two-digit years

GiovanniSalmeri opened this issue · comments

If PickMeUp intends to follow the same rule of Excel, line 599 in pickmeup.js should be:

y += y > 99 ? 0 : (y < 30 ? 2000 : 1900);

Anyway, the condtion y > 100 as now stands does not seem to be correct, because it interprets 100 as 2000, which is never intended.

Just for completeness, I have found two other existing conventions:

PHP, function strtotime:
If the number of the year is specified in a two digit format, the values between 00-69 are mapped to 2000-2069 and 70-99 to 1970-1999. See the notes below for possible differences on 32bit systems (possible dates might end on 2038-01-19 03:14:07).

POSIX:
Values 00 to 68 are prefixed by 20 and 69 to 99 by 19 – that is the behaviour specified by the 2004 and 2008 POSIX standards.

I have no strong opinion on this, feel free to create a PR for improving this behavior.