So, let's say that I stamp documents with UTC or epoch values when
recording time values.
Eventually, I will need to do reporting and math on these values using
local time. Now if there existed a function like...
Date(stamp).localTime("New York")
...that would yield a deterministic result, so it's Kosher for Couch. The
underlying math would be either UTC-5 or UTC-4 depending on the year and US
law, but the mapped output would be predictable.
That said, I don't think such an animal exists in default JS. The
getTimezoneOffset() assumes the browser's time which is fraught. Firstly, I
might need "Los Angeles" time and not "New York" time and that can't depend
on where my CouchDB server is installed. Also I need a map that's aware of
EDT vs EST on a historical basis so that a a particular UTC value in 1995
when daylight savings time switchover was at a different hour is captured.
Anyway, I can make sure to convert times inbound which loses other
reporting functionality like timechange sensitive math or I could store
both at the cost of an extra field.
Any pointers?
Thanks,
-Will
|