Skip to content

Instantly share code, notes, and snippets.

@kares
kares / getTimeZoneOffsetDST.js
Created April 28, 2010 18:43
same as Date.getTimezoneOffset() but with DST
/**
* Calculate the time zone offset with DST !
* e.g. Prague - if DST enabled ? -60 (summer) : -120 (winter)
*
* NOTE: this is to be compatible to how Rails helper
* time_zone_options_for_select renders zones e.g. :
* - in summer (GMT+01:00) Prague
* - in winter (GMT+02:00) Prague
*/
function getTimeZoneOffsetDST() {