[Catalyst] User timezones

Christian Lackas christian at lackas.net
Thu Jun 25 07:54:36 GMT 2009


* 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).

I do know how to do all these things manually one by one, however, I
already foresee that I will miss TZ conversions somewhere or
accidentally do it twice in wrong direction, or ...

I also know how to use inflation/deflation to a DateTime, which allows
me to specify ONE timezone in the Model, however, how do I change the
timezone on a per-user basis.

Christian

-- 
http://www.invicro.com/



More information about the Catalyst mailing list