JavaScript timezone tastiness

Posted by mde [ Mon, 13 Feb 2006 04:34:00 GMT ]

A post over at Why's Ruby blog on using Ruby to pitch Unix timestamps out to JavaScript led me to this really nice, long post by Johan Sundstrom on best practices for dealing with JavaScript and timezones . (Why had a really elegant take on strftime, by the way.)

Both of these posts talk about the three options for dealing with timezone issues in your Web app:

  • Doing the full-on user-preference-based timezone thing
  • Totally punting and not dealing with the issue
  • A solution somewhere in the middle -- using UTC timestamps for everything, and letting the client decide what timezone to show.

They advocate the third solution, which likely provides the most reasonable timezone coverage for most Web apps without ridiculous amounts of work.

Unfortunately for us, Scooby will have to have a much more robust timezone implementation, so we're eventually going to have to implement a complete user-preference-based system. Our conversion to the new ScoobyDate data type for event dates is a good start in that direction.