[Zope-Coders] Replace Zope2 DateTime._parse() with Zope3's DateTimeParser

Andreas Jung andreas@andreas-jung.com
Mon, 25 Nov 2002 17:41:49 +0100


--On Montag, 25. November 2002 16:36 +0000 Chris Withers 
<chrisw@nipltd.com> wrote:

> Lennart Regebro wrote:
>>
>> Actually, I think that 05.12.02 should be 5th December 2002, while
>> 05/12/02 should be 12th of May 2002, and 05-12-02 and 051202 should be
>> 2nd december 2005, simply because you US guys usually use slashes, while
>> european guys usually use dots, while us internationally compliant dudes
>> in Sweden mostly use dashes or nothing at all.
>


While there is lot of discussion on the zope3 list how to solve the 
problem, we
have not found a suitable solution for Zope 2 which is IMO very important.

What about the following idea:

 - the DateTime constructor gets a new keyword argument "datefmt" with two
   possible values "us" (default) and "european"

 - "european" would force the parser to treat the date with day before month
   before year

 - "us" would not change the default behaviour for compatibility reasons

 - a new env variable DATETIME_FORMAT would allow to specify this
   behaviour for the complete Zope instance

 - the ZPUblishers notations for date types should be extended to:

   "field:date" for US dates and

   "field:date_european" for european dateformat (or a notation like
   like "field:date:european" )

Cheers,
Andreas