tz = require 'timezone/loaded' # https://npmjs.org/package/timezone
time = require 'time' # https://npmjs.org/package/time
itr = 5000
zones = ["America/Montreal", "Europe/Prague", "UTC", "Africa/Casablanca"]
for zone in zones
console.log "- #{zone}"
x = new Date
for i in [1..itr]
a = tz '2013-09-01 00:00:00', zone
b = tz '2013-09-01 00:00:00'
o = (a - b) / 1000 / 60
console.log "timezone/loaded #{a}\t #{new Date - x}ms\toffset: #{o}"
x = new Date
for i in [1..itr]
from = new time.Date '2013-09-01 00:00:00'
from.setTimezone zone, true
v = from.valueOf()
o = from.getTimezoneOffset()
console.log "time #{v}\t #{new Date - x}ms\toffset: #{o}"
console.log ""
# - America/Montreal
# timezone/loaded 1378008000000 238ms offset: 240
# time 1378008000000 10994ms offset: 240
#
# - Europe/Prague
# timezone/loaded 1377986400000 444ms offset: -120
# time 1377986400000 933ms offset: -120
#
# - UTC
# timezone/loaded 1377993600000 64ms offset: 0
# time 1377993600000 9372ms offset: 0
#
# - Africa/Casablanca
# timezone/loaded 1377990000000 189ms offset: -60
# time 1377990000000 10339ms offset: -60