This replaces using the package variable $prefformat directly, and
specifically, doing a call to C4::Context->preference() during
module initialization. That way, C4::Dates no longer has a
compile-time dependency on having a valid $dbh.
The inspiration for this is making it easier for
zebraqueue_daemon to have code that detects when
the database connection goes down and then try to
reconnect to the DB.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
When creating a new C4::Dates object, now carps
if the supplied date and/or time is semantically
invalid, i.e., 2007-01-32 will pass the regex
check but is not a valid date (there being no
32nd of January).
As the C4::Dates API is nailed down, these may
be converted to croaks in the future.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
There were 2 bugs :
- one in moremember.pl that supposed the date value to be in preffered order, which is wrong, it's in iso at this time
- the output does not work as expected, as it always return iso.
Pls atz, confirm Dates.pm was bugged.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Minor adjustments to Dates.pm and associated test. You should be able to run a
perl test that uses Context w/o getting fatalsToBrowser output.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Also included is a traditional perl (t/Dates.t) test script.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>