Item2043: parseTime should return undef for invalid date

Priority: Urgent
Current State: Closed
Released In: 1.0.7
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: ArthurClemens
Waiting For: Main.AndrewJones
Last Change By: CrawfordCurrie
With an invalid date, let's say 'a', Foswiki::Time::parseTime returns 0, which is equal to 1 Jan 1970. This makes it impossible to find bugs, or detect if a passed string is a date.

-- ArthurClemens - 12 Sep 2009

This is now fixed in both 1.0.x and 1.1.

I also removed the duplicate code from TablePlugin.

-- AndrewJones - 21 Oct 2009

The code has been modified, but the POD still says:

"If the date format was not recognised, will return 0."

Please, please, please make an effort to maintain the documentation! It was a hell of an effort to reverse engineer from the original undocumented code, and if it creeps out of synch it becomes worse than useless.

-- CrawfordCurrie - 10 Feb 2010

Sorry about this, must have missed it. Will update the docs now.

-- AndrewJones - 11 Feb 2010

Thanks, Andrew, for your quick response. We probably would never have noticed this but for an IRC conversation in which MichaelDaum and I were confused about the apparently stupid behaviour - because both of us had read the doc, but not the code! Sometimes I think doc is just plain dangerous.

-- CrawfordCurrie - 12 Feb 2010

ItemTemplate edit

Summary parseTime should return undef for invalid date
ReportedBy ArthurClemens
Codebase
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor AndrewJones
Checkins distro:fbbd68f6fe36 distro:bd42565d37c7 distro:5cc24f7c9baa distro:bee3ea50d961 distro:e67b90ba876c distro:cac1578b3e61
TargetRelease patch
ReleasedIn 1.0.7
Topic revision: r12 - 12 Feb 2010, CrawfordCurrie
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License