On 7/15/03 8:05 AM, Ben Bennett wrote:
> On Tue, Jul 15, 2003 at 12:14:00AM -0400, John Siracusa wrote:
>> I'm sure you're already doing this, but just in case, make sure to allow for
>> single-digit numbers where there is no ambiguity. [...]
>
> Yes.
(Also stuff like "10/25/2003 5 p.m." Just checking :)
> Actually I wasn't accepting the form 200210130102
> either (I will accept 20021013T0102). Should I?
Yes, definitely for the "200210130102" (or "20021013010259" or
"20021013010259.12345") versions. Those aren't ambiguous at all, as far as
I can see. I can take or leave the "T" :)
> I can add an optional additional parameter dmy_mode (defaults to your
> locale if undef) but I really think inferring it from the locale is
> fine.
Yeah, that sounds better than trying to come up with names for the setting.
> 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");
I'd use the first. (Actually, I'd use DateTime->parse(), which would use
the first for me :) But I don't see why it can't support both.
-John