Item2238: Foswiki::Time does not recognise 1-Jan-2004 as a date
Priority: Urgent
Current State: Closed
Released In: 1.0.8
Target Release: patch
Applies To: Engine
Component:
Branches:
Foswiki::Time does not recognise 1-Jan-2004 as a date. This in turn causes problems with sorting in
TablePlugin. See
Item8302.
Instead of having our own Time parser, wouldn't it be better to use one from CPAN? See
ReplaceFoswikiTimeModule.
--
AndrewJones - 12 Oct 2009
In case anyone else is having sorting problems with
TablePlugin because of the Foswiki::Time bugs, I attached a
patch that replaces Foswiki::Time with Time::ParseDate in
TablePlugin. We are using this patch on our live Foswiki install and have had no complaints yet
Note: I should point out that this is only a quick fix, it is not the way that Foswiki plans to fix these bugs. If you plan on using it, ensure that you properly test it locally. Otherwise, please wait for the next Foswiki release.
--
AndrewJones - 15 Oct 2009
I do not support just adding dependency of Time::ParseDate
TablePlugin is part of standard Foswiki.
Time::ParseDate is not part of standard Perl which means noone can install Foswiki without knowing how to install yet-another-CPAN module. Especially Windows users have a hard time installing these modules. Even I have trouble at work because there is a nasty Firewall between my machine and the world that requires authentication etc. I have learned with time how to get around this but I can imagine how many that give up and never get Foswiki installed.
IF we are going to use this CPAN module we need to include it like we did with CGI::Session. If it is not a pure perl lib - forget it.
Besides - the problem we have should be a simple matter to solve.
There may also be other complications we have not considered. Last time someone fixed something in this area things broke in sorting of numbers. We can risk this module thinks an IP address and other patterns are dates.
And I bet the Time::ParseDate also has the problem of thinking 5/7 is 7th of May. And all us in the "rest-of-world" know this is 5th of July.
- No, it hasn't (looking up its documentation even if you don't have it installed would have cost you less time than typing in your unverified claim). As long as you define how to interpret "5/7" it's possible to parse this in either "dd/mm" or "mm/dd" format. (Admittedly, the underlying real problem is that the input is still ambiguous; the only way to cope with it would be to force the input of a valid (day, month, year) triple or use an unambiguous format.) -- MarkusUeberall - 16 Oct 2009
--
KennethLavrsen - 16 Oct 2009
I am raising this to urgent, as I believe that not being able to sort 1-Jan-2004 as a date is a release blocker and should be fixed whether
ReplaceFoswikiTimeModule gets approved or not.
--
AndrewJones - 16 Oct 2009
I agree on the urgency. Are you looking at it Andrew? Else I may spend a few hours this weekend on fixing this.
--
KennethLavrsen - 16 Oct 2009
No im not currently looking at it, so please feel free :-). Thanks.
--
AndrewJones - 16 Oct 2009
Adding unit tests.
--
AndrewJones - 17 Oct 2009
Thanks. I was going to do that after my good night sleep. Now I can focus on something else.
As I fixed the good I was reminded that the current code only works in English.
It is a major concept update to make it work in more languages and it would require some UI changes also to allow choosing the language. But we need to consider this if we want to be serious about Foswiki being a true international product.
And unfortunately this also talks against Time::ParseDate as it is UK/US only focussed.
--
KennethLavrsen - 17 Oct 2009