I'm running a map reduce job in Mongo db.
The mapping function should map (e.g. count) events of certain nature to days in a certain time zone (the key of the map is calendar day). The time zone can be different, and is effectively an input parameter to the map/reduce job.
The time stored in the database objects is in UTC.
Example:
object1: time=78000
object2: time=86420
mapReduce(objects, tz='America/Los_Angeles')
would return: [{"1/1/1970" : 2}]
and
mapReduce(objects, tz='Europe/London')
would return: [{"1/1/1970":1},{"1/2/1970":1}]
on the same dataset.
The JavaScript Date object can perfectly convert any UTC time into a local time, but it seems to be limited to what's "current" time zone of the J/S environment. I can't seem to find a way to specify the time zone that I want the conversion to be in.
The conversion should account for DST, and preferably for leap seconds.
Is there anything that I can do to achieve this?