[Catalyst] User timezones

Devin Austin devin.austin at gmail.com
Thu Jun 25 07:40:52 GMT 2009


On Thu, Jun 25, 2009 at 1:34 AM, Christian Lackas <christian at lackas.net>wro=
te:

> * Devin Austin <devin.austin at gmail.com> [090625 08:25]:
>
> Hi Devin,
>
> > > I wonder how you handle user-specific timezones in Catalyst.
> > > Is there any magic switch I could set (for instance if the user is
> > > authorized or the session restored) to automatically get the right ti=
me
> > > for the user?
> > I would store it in whatever user profile set up you have for each user.
> > you could simply create a column and add the GMT offset.
>
> thanks for your quick reply, and every user entry in the database
> already has a timezone field.
> The low level mechanics are not so much of a problem. However, I don't
> want to do this everywhere I access a date column from the database
> (basically every table has a creation timestamp, many also for deletion
> or last change).
> What I am looking for, is a transparent way to set a timezone for the
> rest of the request (for instance when the session is restored and thus
> Catalyst knows which user it is dealing with) and then inflate/deflate
> should automatically convert timezones from/to UTC automatically.
> My hope was that somebody has already solved this problem or has an idea
> on how to approach it efficiently.
>
> Christian
>
> --
> http://www.invicro.com/
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>

I have to be honest, I'm not sure I understand.  Perhaps I'm missing
something.

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

If i'm still misunderstanding, please elaborate and maybe I can poke at it
some more.

hth,

-devin

-- =

Devin Austin
http://www.codedright.net
http://www.dreamhost.com/r.cgi?326568/hosting.html - Host with DreamHost!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090625/52be2=
f19/attachment.htm


More information about the Catalyst mailing list