[Zope3-dev] datetimeutils: add localize datetime?
Lennart Regebro
regebro at nuxeo.com
Tue Feb 1 10:14:02 EST 2005
Sidnei da Silva wrote:
> Can't we just use the DateUtil module?
> https://moin.conectiva.com.br/DateUtil
I think thats definitely a viable option.
The parse method is also very good, with a parseinfo structure, which
enabled me to make a custom parse-method that works the way I want, by
making a parseinfo based on the string I found, and then passing it to
the parser method.
Because, *I* want guessing. Or rather, I want to be able to have a
specific time format as default, but if that fails, I want to see if the
date is obvious. So even if the selected time format is "M/D/Y" of
somebody writes "2005-06-17" I want to accept that, because it can only
mean one date.
On the other hand, I don't need to parse strings with "January" or
"Måndag" in them. I do agree that guessing should not be default
behaviour, and I do agree that it may be useful to be able to parse
non-numerical dates.
But I need to parse what people type in, and honestly, people don't
write "January", the write "01", because it's faster. But they DO write
"060203", and that needs to be interpreted as the 3rd of February 2005
in Sweden, but 6th of February 2003 in other places.
So: the idea of a parser that parses a string according to a bunch of
settings (in this case a ParseInfo class) is very good, because it's
flexible enough to allow people to customize the parsing to their liking.
I don't know if Gustavos module can interpret month names, and I don't
remember if it can be set not to allow "semi-guessing", but it seems to
me that these are things that it could be extended with quite easily.
--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
More information about the Zope3-dev
mailing list