saheb11 / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

parseExact misunderstands year 0001-0099 as 1901-1999 #122

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
What is the expected output? What do you see instead?

1. Date.parseExact( "01/01/0001", "dd/MM/yyyy" ) //expect 0001, get 1901
2. Date.parseExact( "01/01/0099", "dd/MM/yyyy" ) //expect 0099, get 1999
3. Date.parseExact( "01/01/0100", "dd/MM/yyyy" ) //correct 0100

What version of the product are you using? On what operating system?
1.0 Alpha-1 on XP

Please provide any additional information below.

Original issue reported on code.google.com by thetoolman on 20 May 2011 at 2:27

GoogleCodeExporter commented 8 years ago
This is due to the way the Date constructor works (it parses years less than 
100 as 1900-1999).

Fixed in my fork by adding additional call to setFullYear in that case: 
https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 18 Sep 2013 at 6:57