On 7/14/03 11:10 PM, Ben Bennett wrote: > I am taking a whack at DT::F::Simple (please speak up now if anyone > else wants to claim this project) that can parse things that are > similar to the ones that Date::Parse can do.
Sweet, someone took the bai--...er, "picked up the baton" ;) > Namely: > - Rough ISO8601 strings (only complete datetimes and dates) > - Dates with '-', '.', or '/' separators (either by month number or > localized short or long name) > - Times with ':' or '-' separator and optional localized AM/PM > - Day names will be used to sanity check the parsed date if present > - I will use localized BC/AD if present 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. This is essential for handling "user-created" input. Examples: 9/3/2002 (e.g. don't require 09/03/2002) 1:02 (e.g. don't require 01:02) and maybe even: 200210131:02 but that may make some people break out in hives, so whatever :) 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 :) > Which leads to my problem, there appears to be no simple way to get > the date order to differentiate m/d/y from d/m/y. Don't. Make it a setting. I've been trying to think of what to name this setting, but have no good ideas. Here are some bad ones instead: DT::F::Simple->use_mmddyyyy(1); DT::F::Simple->use_ddmmyyyy(1); DT::F::Simple->mode('us'); DT::F::Simple->mode('euro'); DT::F::Simple->euro_mode(1); DT::F::Simple->us_mode(1); Gah, that's horrible :) Someone out there must have some sort of pre-existing vocabulary to describe the date format differences. Is it just regional, or are there ISO numbers to reference or what? -John