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
Reported By: AndrewJones
Waiting For: Main.KennethLavrsen
Last Change By: KennethLavrsen
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 smile

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

ItemTemplate edit

Summary Foswiki::Time does not recognise 1-Jan-2004 as a date
ReportedBy AndrewJones
Codebase 1.0.7, trunk
SVN Range Foswiki-1.0.7, Sun, 20 Sep 2009, build 5061
AppliesTo Engine
Priority Urgent
CurrentState Closed
WaitingFor KennethLavrsen
Checkins distro:d3d160f11360 distro:530248b8ee1d distro:c9bdece168f4 distro:3d3b1f4e23c5 distro:3891865868fa distro:e8425ec1394c
TargetRelease patch
ReleasedIn 1.0.8
Topic attachments
I Attachment Action Size Date Who Comment
tableplugin-parsedate.patchpatch tableplugin-parsedate.patch manage 972 bytes 15 Oct 2009 - 13:02 AndrewJones Patch for TablePlugin to use Time::ParseDate instead of Foswiki::Time
Topic revision: r19 - 29 Nov 2009, KennethLavrsen - This page was cached on 14 Jan 2020 - 23:15.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy