pingjiang / datejs

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

Date.parse creating wrong day in month #71

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Example date: "Mon Apr 20 20:05:30 +0000 2009"
2. var d = Date.parse(time);
// also, capital S does not produce the ordinal...
3. d.toString("h:mm tt MMM d") + d.getOrdinal();

What is the expected output?
8:42 AM Apr 20rd

What do you see instead?
7:42 AM Apr 23rd

What version of the product are you using? On what operating system?
latest version as of 4/20 on osx and win vista

The date above is one of 3, the first 2 work correctly (e.g. "Wed Apr 22
14:13:57 +0000 2009", "Tue Apr 21 17:29:36 +0000 2009"). Additionally,
these dates are part of the JSON from a twitter -
http://twitter.com/statuses/user_timeline.json

Original issue reported on code.google.com by rob.koberg on 23 Apr 2009 at 11:47

GoogleCodeExporter commented 9 years ago
BTW, this works (remove timezone info):

  var d = Date.parse(time.substring(0, time.indexOf(" +")));

Original comment by rob.koberg on 23 Apr 2009 at 11:56

GoogleCodeExporter commented 9 years ago
It did not work for me with the date:  "Tue, 08 Nov 2011 16:12:28 +0000"
File: pt-br
Even removing the +0000 it does not convert this date

Original comment by riderma...@bindsolution.com on 8 Nov 2011 at 7:54

GoogleCodeExporter commented 9 years ago
getOrdinal doesn't exist in the current version on this site. I've added a 
getOrdinate function into my fork but the parsing is also fixed - 
https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 16 Sep 2013 at 1:30