Titanium JIRA Archive
Alloy (ALOY)

[ALOY-797] momentjs 2.1 zone() behavior has changed with moment-timezone release

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionWon't Fix
Resolution Date2014-02-10T16:45:31.000+0000
Affected Version/sAlloy 1.2.0
Fix Version/s2014 Sprint 03
ComponentsBuiltins
Labelsn/a
ReporterAlan Leard
AssigneeTim Poulsen
Created2013-08-19T17:27:53.000+0000
Updated2014-02-13T21:35:01.000+0000

Description

Description

The latest momentjs library has changed the timezone offset functionality breaking the previous implementation. I believe this is due to the release of the new momentjs timezone library which we may want to start including as well.

Test Case

I have attached a simple test case which includes the momentjs 2.0 library to demonstrate the difference in behavior.

Resources

New timezone library: http://momentjs.com/timezone/

Attachments

FileDateSize
app.zip2013-08-19T17:27:53.000+00004987698

Comments

  1. Tim Poulsen 2014-02-10

    To use the new timezone library, you also need to generate and include timezone-data for the timezones you plan to support (http://momentjs.com/timezone/data/) We'd have to include every timezone to create a universal solution. This seems better done by the individual developers so that they can tailor the code to the timezones they want to support. Updating the app.zip you attached, I'd have to do something like this (the tz-data could be in a separate file of course)
       var momentTZ = require('moment-timezone');
       momentTZ.tz.add({
           "zones": {
               "America/Los_Angeles": [
                   "-7:52:58 - LMT 1883_10_18_12_7_2 -7:52:58",
                   "-8 US P%sT 1946 -8",
                   "-8 CA P%sT 1967 -8",
                   "-8 US P%sT"
               ]
           },
           "rules": {
               "US": [
                   "1918 1919 2 0 8 2 0 1 D",
                   "1918 1919 9 0 8 2 0 0 S",
                   "1942 1942 1 9 7 2 0 1 W",
                   "1945 1945 7 14 7 23 1 1 P",
                   "1945 1945 8 30 7 2 0 0 S",
                   "1967 2006 9 0 8 2 0 0 S",
                   "1967 1973 3 0 8 2 0 1 D",
                   "1974 1974 0 6 7 2 0 1 D",
                   "1975 1975 1 23 7 2 0 1 D",
                   "1976 1986 3 0 8 2 0 1 D",
                   "1987 2006 3 1 0 2 0 1 D",
                   "2007 9999 2 8 0 2 0 1 D",
                   "2007 9999 10 1 0 2 0 0 S"
               ],
               "CA": [
                   "1948 1948 2 14 7 2 0 1 D",
                   "1949 1949 0 1 7 2 0 0 S",
                   "1950 1966 3 0 8 2 0 1 D",
                   "1950 1961 8 0 8 2 0 0 S",
                   "1962 1966 9 0 8 2 0 0 S"
               ]
           },
           "links": {}
       });
       alert("moment-timezone response:" + momentTZ().tz("America/Los_Angeles").format());
       

JSON Source