[Zope3-dev] Re: SVN: Zope3/branches/3.3/ Fixed issue 525: DateWidget ru-format

Dmitry Vasiliev lists at hlabs.spb.ru
Mon Jul 3 04:11:42 EDT 2006


Christian Theune wrote:
> Dmitry Vasiliev wrote:
>>
>> I agree the i18n datetime parsing should be made a bit relaxed. I even 
>> think the only important thing in this context is the order of the 
>> fields, so we can ignore spaces (or even ignore some other 
>> delimitters?) and maybe ignore other non-field characters (for example 
>> in the russian "long" format you always need to write year as "year 
>> 2006" instead of the simple "2006").
> 
> I'm very much against "relaxed" date/time format checking. I tend to 
> give my user the exact format that is expected and fail otherwise. All 
> the guessing in the past led to bad bad errors because the field order 
> the user entered was syntactically compatible but had a semantically 
> different meaning.
> 
> E.g.
> 
> 02/05/2005 and 02.05.2005 are two different things.

"Relaxed" doesn't mean "try to parse any possible datetime format in the 
world". For each locale the ICU XML files contains 4 date formats and 4 time 
formats. The formats mainly useful for formatting printable datetime 
representation and a bit strict for parsing. So there are my ideas:

  - it would be useful if DateTimeFormat (hmm, maybe also NumberFormat) might 
to parse any format combination for the current locale (if it possible) in some 
"unstrict" mode;

  - I think it would be safe to parse any number of space characters as one 
space character and ignore literal (quoted in the pattern) characters on input;

  - I think it would be safe to interchange long and short month names on input 
(as Gary already pointed);

-- 
Dmitry Vasiliev (dima at hlabs.spb.ru)
     http://hlabs.spb.ru


More information about the Zope3-dev mailing list