markjugg has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on Data::FormValidator again. This time I'm working on adding some date validation to the core module. I'd like to make my solution scalable so it's easy to validate dates in other formats besides the ones I prefer myself.
My plan is to parse a string with a regular expression, and then feed it to Date::Calc's check_time() and check_date() functions.
I realize Date::Manip is out there as a solution that will parse most any string, but's such a beast to load.
I'm thinking of an interface like this
valid_date($your_date, 'MM/DD/YYYY'),
What I'm hoping to find is that there is easy way to start with this input and end up with ($mm,$dd,$yyyy), given the possibilities for a variety of different date formats.
As an alternative, we could use a solution that hard codes a few of the popular date formats, so the interface would look more like this:
valid_date($your_date, 'US'),
Thanks for any suggestions!
-mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: date format string -> Reg Ex solution
by Koschei (Monk) on Apr 23, 2003 at 22:18 UTC | |
|
Re: date format string -> Reg Ex solution
by jaldhar (Vicar) on Apr 23, 2003 at 15:29 UTC | |
by Anonymous Monk on Apr 23, 2003 at 17:55 UTC | |
|
Re: date format string -> Reg Ex solution
by dragonchild (Archbishop) on Apr 23, 2003 at 15:15 UTC | |
|
Re: date format string -> Reg Ex solution
by Corion (Patriarch) on Apr 23, 2003 at 15:16 UTC | |
|
Re: date format string -> Reg Ex solution
by hardburn (Abbot) on Apr 23, 2003 at 15:32 UTC | |
|
Re: date format string -> Reg Ex solution
by Jenda (Abbot) on Apr 23, 2003 at 17:28 UTC | |
by markjugg (Curate) on Apr 23, 2003 at 19:06 UTC | |
by Jenda (Abbot) on Apr 23, 2003 at 20:44 UTC | |
|
Re: date format string -> Reg Ex solution
by adamk (Chaplain) on Apr 24, 2003 at 08:58 UTC |