DateTime::Locale defines 4 lengths for dates and times (full, long,
medium, and short), defines which date format length is the default
one and which time one is the default. It also defines whether the
date preceeds the time or not.
With all of this info, I think it would be nice to be able to use it
to print the locale appropriate "default datetime string" as well as
the "default date", default time" and all 4 lengths for both date and
time.
Does it make sense to add methods to DateTime to allow for this, or is
it a separate class? My argument for adding it to DT is that if they
are methods on the DT object then you can use strftime to print them
in conjunction with other info (but I am not sure if that is really
useful).
It would be really nice to be able to automatically parse one of these
generated strings using DT::F::Strptime, The gotcha there is that a
bunch of the formats end up being mapped to method calls on DateTime
(e.g. %{day}) and as far as I can tell those are not yet supported.
Obviously we would not be able to parse arbitrary methods, but we
could at least add support for the core DT ones.
As a final question, is it a security hole that we allow method calls
on a DT object from strftime strings? Since we are not passing
arguments I think all of the methods that could be called are pretty
safe. Also I assume that you will not be getting strftime format
strings from unsafe sources, but I figured it was worth mentioning.
Thanks,
-ben