[Catalyst] User timezones

Moritz Onken onken at houseofdesign.de
Thu Jun 25 10:49:39 GMT 2009

Am 25.06.2009 um 09:54 schrieb Christian Lackas:

> * Devin Austin <devin.austin at gmail.com> [090625 09:43]:
> Hi Devin,
>> I would approach it so that when the user registers, they choose  
>> their time
>> zone. When they login, this information is stored into their  
>> session, and
>> retrieved whenever.
> agreed.
>> I would store it in the session in the form you want it to be
>> presented, which would save you whatever time it would take to be
>> inflating it.
> Now the problem begins:
> I have tables for studies, series and images (and many more), each of
> them has multiple timestamps (e.g. when the study was created, the
> series acquired, the image processed, and when everything was created
> and deleted).
> So when I access all these times, I would have to convert all of them,
> e.g. in a template
>    [% study.time.convertTZ(c.user) %]
>    [% series.time.convertTZ(c.user) %]
> rather than just use (after Catalyst knows about the users timezone,
> somehow).
>    [% study.time %]
>    [% series.time %]
> and I must not miss a single value. And things get even more  
> complicated
> when I filter for times (e.g. show images created in the last 3  
> hours),
> or if I want to show only datasets whose deletion date is in the past
> (could have be deleted in Europe and should also be gone in the US).

Hi Christian,

I don't quite get the above paragraph. If you search for db entries  
have been created in the last 3 hours and you have a column "created_on"
which stores the time of creation incl. time zone (of your server) you
won't face any problems because you can simply search for them.

The problem occurs only if you store the current time of the user  
time zone in the "created_on" column.

To the original question:
I'd say that the conversion between time zones belongs in the View. As  
you are
doing it already with [% study.time.convertTZ(c.user) %]. I see that  
means you have to type more but neither the controller nor the model  
do this conversion.


More information about the Catalyst mailing list