On Tue, 15 Jul 2003, Ben Bennett wrote:

> > and maybe even:
> >
> >     200210131:02
>
> No!  Egads :-)  Actually I wasn't accepting the form 200210130102
> either (I will accept 20021013T0102).  Should I?

Is the former form unambiguous?  If so, you mighta s well accept it.

> > Also, don't forget about the optional "." in "a.m." and "p.m."  I'm
> > not quite sure how that'd get localized, but the point is that the
> > localized am/pm thingies must be regexes, not constant strings (or,
> > okay, a regex constructed out of a list of constant strings, if you
> > want :)
>
> Yeah, I was trying to work that out.  It appears not to be in the raw
> locale data, so I was considering just accepting the am/pm stuff with
> optional inserted periods, even for other locales.  I still have to
> survey all locales to see if that is even reasonable.  The other
> choice would be to special case BC and AD to allow the dotted form,
> but that seems a bit restrictive.

Yeah, there's really no way to get a regex from the locale data.

> Speaking of which, what interface do people want?
>
>   my $us_parser = DateTime::Format::Simple->new(locale => "en_US");
>   my $dt = $us_parser->parse_datetime("2/11/74");
>
> Or:
>
>   my $dt = DateTime::Format::Simple->parse_datetime(string => "2/11/74",
>                                                   locale => "en_US");

Both!  The latter can just wrap the former.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to