freshlover / datejs

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

date.parse( "3pm tomorrow" ) returns the date of tomorrow, 12:00:00 AM. #46

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

date.parse( "3pm tomorrow" ) // Done on 9/12/2008.

What is the expected output? What do you see instead?

Expected: Saturday, September 13, 2008 03:00:00 PM
Actual:   Saturday, September 13, 2008 12:00:00 AM
In other words, it's not bothering with the time portion of the english phrase.

What version of the product are you using? On what operating system?
FF3 / Windows XP.

Original issue reported on code.google.com by bjmille...@gmail.com on 12 Sep 2008 at 2:57

GoogleCodeExporter commented 8 years ago
Same thing on FF3.5.7 Win2K3.

Funny thing is, I could've sworn this was working correctly a few weeks 
ago...maybe I
wasn't looking very closely.

Original comment by k...@brantaero.com on 22 Jan 2010 at 9:55

GoogleCodeExporter commented 8 years ago
What is happening in the code is that the parser is processing the information 
in one loop. It is either processed as a 'set' or a 'add' function, getting 
into trouble when processing something like 'tomorrow at 5pm'. This is neither 
a 'set' nor an 'add' function, but should be split in two and processed 
separately. I've fixed this bug in a separate github repository since we where 
hitting the same issue. I solved it by allowing the 'parse' to be part of the 
chain (so now we can do things like 'Date.parse('tomorrow').parse('at 5pm')'. 
The parser itself uses this and splits the line in two, handling both separate. 
This results in the correct answers and the tests in Ruby_chronic are now green.

Original comment by i...@hecbv.nl on 12 Jul 2011 at 7:51