[html-formfu] PATCH for timezone support for H::F::Inflator::DateTime

Carl Franks fireartist at gmail.com
Thu Jul 17 21:47:04 BST 2008

2008/7/17 Michele Beltrame <mb at cattlegrid.info>:
> Hello!
> I'm attaching a small patch which provides the ability to pass a
> time_zone parameter to the DateTime inflator, in this fashion:
>    inflators   => [{
>        type      => 'DateTime',
>        time_zone => 'Europe/Helsinki',
>        parser    => { strptime  => "%Y-%m-%d %H:%M" },
>    }],
> This allows the DateTime object created from a string which does not
> contain time zone information to be returned in a definite time zone
> instead of the floating one.
> I find this particularly useful in my code in this way (Catalyst
> example):
>        time_zone => $c->stash->{userdata}->time_zone',
> This allows me to have date and time the user enters automatically
> stored with the correct time zone, if if he/she doesn't indicate it
> (which happens all the time).
> As usual, I'll provide docs and tests is the patch gets accepted. ;)

Yup - this looks good.
Please do commit this.

Also, the 'strptime' hashref gets passed to
DateTime::Format::Strptime->new(), which also accepts a 'time_zone'
Would it be a good idea to also pass along the inflator's 'time_zone',
if there's not one set in the 'strptime' arguments?


More information about the HTML-FormFu mailing list