Open GoogleCodeExporter opened 8 years ago
Patch added to SVN with r3866.
Do you have some JUnit tests for the different time formats?
Original comment by axelclk@gmail.com
on 19 Oct 2011 at 4:11
I haven't implemented any kinds of tests, sorry
(this was just a quick hack which seemed to work for me)
Original comment by nico.kru...@googlemail.com
on 19 Oct 2011 at 4:15
Original comment by axelclk@gmail.com
on 27 Jan 2012 at 3:40
for more flexibility in the date parameter, I'd suggest to use the date parser
from https://github.com/collegeman/stringtotime (recall that all parameters
should be possible that PHP's strtotime() accepts). I don't know how you feel
about adding this dependency but it surely beats implementing this on your own.
- try {
- date = df.parse(dateTimeParameter);
- } catch (ParseException e) {
- return "<span class=\"error\">Error: invalid time</span>";
- }
+ try {
+ date = new StringToTime(dateTimeParameter);
+ } catch (StringToTimeException e) {
+ return "<span class=\"error\">Error: invalid time</span>";
+ }
Original comment by nico.kru...@googlemail.com
on 11 Apr 2012 at 12:47
Only a quick test (I haven't used #time so much)
{{#time:z|{{{1|April 14}}}}}
gives "103" from StringToTime() library
thereas in the Sandbox
http://en.wikipedia.org/wiki/Wikipedia:Sandbox
I get "104" ?
Original comment by axelclk@gmail.com
on 11 Apr 2012 at 2:23
you are correct, it seems that StringToTime has a typo parsing month and day in
https://github.com/collegeman/stringtotime/blob/master/src/main/java/com/clutch/
dates/StringToTime.java#L690
-> they add 1 where nothing should be added...
I'll try to get a patch upstream...
Original comment by nico.kru...@googlemail.com
on 11 Apr 2012 at 2:37
(this means, that StringToTime thinks it is 2013 already)
Original comment by nico.kru...@googlemail.com
on 11 Apr 2012 at 2:37
I made a patch and send it to the owner...let's see how this works out
https://github.com/NicoK/stringtotime/commit/c9051e8fdad40a068fa583a6ec9664dfe34
23191
Original comment by nico.kru...@googlemail.com
on 11 Apr 2012 at 2:48
Apparently, the author does not maintain the library anymore.
He made me contributor though and I added my patch to the official stringtotime
repo at github. I'd rather add fixes there than re-implement everything :)
Original comment by nico.kru...@googlemail.com
on 12 Apr 2012 at 7:24
FYI: I tagged the new version and created the jar file at
https://github.com/downloads/collegeman/stringtotime/stringtotime-1.0.6.jar
don't know about maven integration and how that works in general though
Original comment by nico.kru...@googlemail.com
on 12 Apr 2012 at 8:34
Added r4455.
At the moment I simply copied the 2 files in the environment.
Original comment by axelclk@gmail.com
on 14 Apr 2012 at 11:38
thanks,
you probably also need to include the copyright notice, as mentioned here:
https://github.com/collegeman/stringtotime/blob/master/LICENSE
Original comment by nico.kru...@googlemail.com
on 16 Apr 2012 at 9:57
Original comment by axelclk@gmail.com
on 3 Jul 2012 at 5:34
Original issue reported on code.google.com by
nico.kru...@googlemail.com
on 19 Oct 2011 at 8:07Attachments: