pingjiang / datejs

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

[FIXED] "weeks" not recognised as plural of "week" #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. type "+2 weeks"

What is the expected output? What do you see instead?
Expect the date two weeks from now; get an error instead.  ("+2 years" works.)

Original issue reported on code.google.com by elbig...@gmail.com on 28 Nov 2007 at 8:31

GoogleCodeExporter commented 9 years ago
We're working on this problem right now. The parser is figuring out the string
properly, but a problem happens somewhere after the date is passed back into the
library. I think. Anyways, a fix is imminent.

Original comment by geoff%co...@gtempaccount.com on 28 Nov 2007 at 8:41

GoogleCodeExporter commented 9 years ago
Found the problem. Of course it's always the simplest things.

The 'week' regex pattern was not checking for the plural form 'weeks' only 
'week'.

The fixed should be checked into SVN shortly. If you need the fix immediately, 
please
search your date.js file for the following string...

/^w(ee)?k/i,

... add replace with the following ...

/^w((ee)?k)?s?/i,

We should have had a test case that included week math. Now we do, see
http://www.datejs.com/test/relative/

The www.datejs.com "Mad Skillz" widget has been updated and now works with "+5 
weeks".

Original comment by geoff%co...@gtempaccount.com on 28 Nov 2007 at 9:21