[Koha-devel] C4 and date formats

Joe Atzberger ohiocore at gmail.com
Fri Dec 21 17:49:16 CET 2007


Without intending to contradict your suggestion, the recent work this week
by myself and several others moves in the opposite direction of passing only
ISO date strings between modules.

The main reason this makes sense is that scripts still need to be validating
user input, regardless of format, before calling things like ModMember.  A
C4::Dates object provides validation functionality (via the regexp()
function) to the script, so the script might as well do the conversion
also.

The problem of double-conversion can also positively be avoided by passing
C4::Dates objects themselves rather than date strings.  This should be the
standard for new code.  (Unfortunately, nothing in the old code does this
yet.)   For 3.2, we intend to return undef on invalid constructor
argument(s) and make a sweep of the code to ensure scripts actually care
whether or not their date string was valid.  As it stands in 3.0, too many
places just call format_date_in_iso($any_old_string).

Thanks to Galen Charlton's help debugging C4::Dates, we have cleaned up a
problem with multiple objects not receiving unique dataspace.  I want to
apologize to Paul, because I think he detected this very early on, and I
didn't understand at that time what he was indicating.  You should be able
to verify now that it is fixed, and use any arbitrary number of objects.
This clears the way for more widespread usage.

The comments about timezones address a separate issue from the date
*formats* supported by koha (iso, metric, us).  C4::Dates does not affect
anything to do with timezones.

--joe atzberger

LibLime  *  Open-Source Solutions for Libraries
888-564-2457

On Dec 15, 2007 3:12 PM, Ryan Higgins <ryan.higgins at liblime.com> wrote:

> Hey folks
>
> Just looking for a quick consensus on passing dates to
> C4 modules.  Some expect iso, some expect local format.
>
> memberentry.pl is currently not working because the
> date is double iso'ed...
>
> I suggest the coding guideline that scripts maintain the date in local
> syspref-defined
> format, and that  all public methods in C4::* should expect
> dates to be passed in local format.  So format_date_in_iso
> should be rare at the script level.
>
> comments ?
>
> --
> Ryan Higgins
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-devel/attachments/20071221/987e4d98/attachment-0002.htm>


More information about the Koha-devel mailing list