Permalink
Browse files

Issue #36: timezone-js doesn't handle static dst offset rules

Create a pseudo rule when the DST offset of a Zone is specified as a duration instead of a rule reference.
  • Loading branch information...
1 parent 582127e commit 8c4260e7f4ce371b64020983968fc7be6d905b30 @divide0 divide0 committed Feb 6, 2013
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/date.js
View
@@ -540,6 +540,13 @@
var date = typeof dt === 'number' ? new Date(dt) : dt;
var ruleset = zone[1];
var basicOffset = zone[0];
+
+ // If the zone has a DST rule like '1:00', create a rule and return it
+ // instead of looking it up in the parsed rules
+ var staticDstMatch = ruleset.match(/^([0-9]):([0-9][0-9])$/);
+ if (staticDstMatch) {
+ return [-1000000,'max','-','Jan',1,parseTimeString('0:00'),parseInt(staticDstMatch[1]) * 60 + parseInt(staticDstMatch[2]), '-'];
+ }
//Convert a date to UTC. Depending on the 'type' parameter, the date
// parameter may be:

0 comments on commit 8c4260e

Please sign in to comment.