[Cosmo-dev] Timezones and the Cosmo UI

Matthew Eernisse mde at osafoundation.org
Thu Oct 19 10:52:06 PDT 2006


I've been exchanging e-mails with Adam Peller and some of the other Dojo 
guys about timezone support in Dojo, which is nonexistent (except for 
the getTimezoneName function I contributed for 0.4). I told Adam this 
past week that I'd take a stab at an experimental implementation.

Last weekend I spent some time looking at the Olson DB, and the 
different parsers available (including an incomplete/broken GPL 
JavaScript version) and then took a couple of hours to hammer together 
some working code.

Adam and I had originally been talking about JSON-izing the Olson data, 
and then doing XHR fetches of rules as neeeded. But the Olson stuff is 
pretty straightforward structured data, and the files are not that big 
(northamerica and europe are 100K and 104K, respectively -- with their 
boatloads of comments), so I just took the approach of parsing the 
actual data into memory.

Both the initial parsing of the zones and rules, and offset lookups for 
a given TZ for a given date seems to be pretty fast, so it looks like we 
can actually do client-side lookups, at least for timezones recognizable 
as Olson timezones. (That is, of course, if we decide to assume that TZs 
with TZIDs that look like standard ones are, in fact, standard ones.) 
That doesn't alleviate the problem of actual custom TZs of course.

The stuff I wrote just piggybacks the TZ stuff onto normal JS Dates 
(using GMT for everything), but a full implementation would probably 
work better with something like our Scooby/CosmoDates.

I'll throw up an example page later today so y'all can see the code and 
play around with it.


Matthew



More information about the cosmo-dev mailing list