Testing incrementing timezoneJS Dates

by jamstooks

HTML

<script src="https://rawgit.com/mde/timezone-js/f3efe06555c57be51cad708c7e19889264e89b83/src/date.js"></script>
<h5>First Date</h5>
<span id="d1"></span>

<h5>Second Date</h5>
<span id="d2"></span>

<h5>Third Date</h5>
<span id="d3"></span>

<h5>Forth</h5>
<span id="d4"></span>

JavaScript

var olson, validDate, invalidDate, prependClass, script;

// Preparsed America/Los_Angeles definition
olson = {
    "zones": {
        "America/Los_Angeles": [
            [472.9666666666667, "-", "LMT", -2717668378000],
            [480, "US", "P%sT", -725932800000],
            [480, "CA", "P%sT", -63244800000],
            [480, "US", "P%sT", null]
        ]
    },
    "rules": {
        "US": [
            [1918, 1919, "-", "Mar", "lastSun", [2, 0, 0, null], 60, "D"],
            [1918, 1919, "-", "Oct", "lastSun", [2, 0, 0, null], 0, "S"],
            [1942, "only", "-", "Feb", "9", [2, 0, 0, null], 60, "W", ""],
            [1945, "only", "-", "Aug", "14", [23, 0, 0, "u"], 60, "P", ""],
            [1945, "only", "-", "Sep", "30", [2, 0, 0, null], 0, "S"],
            [1967, 2006, "-", "Oct", "lastSun", [2, 0, 0, null], 0, "S"],
            [1967, 1973, "-", "Apr", "lastSun", [2, 0, 0, null], 60, "D"],
            [1974, "only", "-", "Jan", "6", [2, 0, 0, null], 60, "D"],
            [1975, "only", "-", "Feb", "23", [2, 0, 0, null], 60, "D"],
            [1976, 1986, "-", "Apr", "lastSun", [2, 0, 0, null], 60, "D"],
            [1987, 2006, "-", "Apr", "Sun>=1", [2, 0, 0, null], 60, "D"],
            [2007, "max", "-", "Mar", "Sun>=8", [2, 0, 0, null], 60, "D"],
            [2007, "max", "-", "Nov", "Sun>=1", [2, 0, 0, null], 0, "S"]
        ],
        "CA": [
            [1948, "only", "-", "Mar", "14", [2, 0, 0, null], 60, "D"],
            [1949, "only", "-", "Jan", "1", [2, 0, 0, null], 0, "S"],
            [1950, 1966, "-", "Apr", "lastSun", [2, 0, 0, null], 60, "D"],
            [1950, 1961, "-", "Sep", "lastSun", [2, 0, 0, null], 0, "S"],
            [1962, 1966, "-", "Oct", "lastSun", [2, 0, 0, null], 0, "S"]
        ]
    }
}

// Initialize timezoneJS
var _tz = timezoneJS.timezone;
_tz.loadingScheme = _tz.loadingSchemes.MANUAL_LOAD;
_tz.loadZoneDataFromObject(olson, true);

var d1 = new timezoneJS.Date("2014/4/14", 'America/Los_Angeles');
var d2 =...