Undocumented Behaviour in C4::Dates
Interesting, C4::Dates allows you to instantiate a Date with a day value of 00. Not sure why you really want this behaviour but nowhere does it actually document what this means. We assume that this is intended behaviour as t/Dates.t actually confirms it. But there's no documentation of what it does to a date. If you look at the output from t/Dates.t creating a date with 0/1/1952 (I'm using dmy here) returns a formatted version of 31/12/1951. i.e. ) has a "kind of -1" effect Odd? Confused? Poor Interface? C. -- Colin Campbell Chief Software Engineer, PTFS Europe Limited Content Management and Library Solutions +44 (0) 845 557 5634 (phone) +44 (0) 7759 633626 (mobile) colin.campbell@ptfs-europe.com skype: colin_campbell2 http://www.ptfs-europe.com
If you look at the output from t/Dates.t creating a date with 0/1/1952 (I'm using dmy here) returns a formatted version of 31/12/1951. i.e. ) has a "kind of -1" effect
Odd? Confused? Poor Interface?
Does it take negative numbers too? -3/1/1952? If it works consistently and correctly I would say it's a feature: It lets you do simple math on a day of the month and get back a valid date. -- Owen -- Web Developer Athens County Public Libraries http://www.myacpl.org
On 04/05/11 13:37, Owen Leonard wrote:
If you look at the output from t/Dates.t creating a date with 0/1/1952 (I'm using dmy here) returns a formatted version of 31/12/1951. i.e. ) has a "kind of -1" effect
Odd? Confused? Poor Interface?
Does it take negative numbers too? -3/1/1952? If it works consistently and correctly I would say it's a feature: It lets you do simple math on a day of the month and get back a valid date. No that just causes it to abort and log Invalid date instead of putting out an unpredicted date and logging Invalid Date... and if I wanted to do date math I'd not do it with C4::Dates....
-- Colin Campbell Chief Software Engineer, PTFS Europe Limited Content Management and Library Solutions +44 (0) 845 557 5634 (phone) +44 (0) 7759 633626 (mobile) colin.campbell@ptfs-europe.com skype: colin_campbell2 http://www.ptfs-europe.com
Le 04/05/2011 11:25, Colin Campbell a écrit :
Interesting, C4::Dates allows you to instantiate a Date with a day value of 00. Not sure why you really want this behaviour but nowhere does it actually document what this means. We assume that this is intended behaviour as t/Dates.t actually confirms it. But there's no documentation of what it does to a date. If you look at the output from t/Dates.t creating a date with 0/1/1952 (I'm using dmy here) returns a formatted version of 31/12/1951. i.e. ) has a "kind of -1" effect I don't see the logic. And it's not how mySQL handles "0". iirc, mySQL consider 0 as "I dont know and I don't care, just remember M and Y"
-- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08
participants (3)
-
Colin Campbell -
Owen Leonard -
Paul Poulain