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

Moritz Onken onken at houseofdesign.de
Thu Jul 17 17:58:30 BST 2008


Could you implement a default_time_zone config option?
This would be really useful beacase you only have to set it once.

cheers,

moritz


Am 17.07.2008 um 16:36 schrieb Michele Beltrame:

> 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. ;)
>
> Thanks,
> Michele.
>
> -- 
> Michele Beltrame
> http://www.cattlegrid.info/
> ICQ 76660101 - MSN mb at italpro.net
> <
> Inflator_DateTime_timezone
> .patch>_______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu




More information about the HTML-FormFu mailing list