Skip to content

Commit

Permalink
Added group-leaders.json to be used to detect group leaders
Browse files Browse the repository at this point in the history
  • Loading branch information
ellenaua committed Apr 18, 2018
1 parent 99bd187 commit e0cf4dc
Show file tree
Hide file tree
Showing 15 changed files with 598 additions and 46 deletions.
16 changes: 8 additions & 8 deletions builds/moment-timezone-with-data-2012-2022.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! moment-timezone.js
//! version : 0.5.15
//! version : 0.5.16
//! Copyright (c) JS Foundation and other contributors
//! license : MIT
//! github.com/moment/moment-timezone
Expand All @@ -24,7 +24,7 @@
// return moment;
// }

var VERSION = "0.5.15",
var VERSION = "0.5.16",
zones = {},
links = {},
names = {},
Expand Down Expand Up @@ -728,7 +728,7 @@
"Pacific/Pitcairn|-08|80|0||56",
"Pacific/Gambier|-09|90|0||125",
"Etc/UCT|UCT|0|0|",
"Etc/Universal|UTC|0|0|",
"Etc/UTC|UTC|0|0|",
"Europe/Astrakhan|+04 +03|-40 -30|010|1N7y0 3rd0",
"Europe/London|GMT BST|0 -10|01010101010101010101010|1GNB0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|10e6",
"Europe/Chisinau|EET EEST|-20 -30|01010101010101010101010|1GNA0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|67e4",
Expand Down Expand Up @@ -1091,11 +1091,11 @@
"Australia/Sydney|Australia/Tasmania",
"Australia/Sydney|Australia/Victoria",
"Etc/UCT|UCT",
"Etc/Universal|Etc/UTC",
"Etc/Universal|Etc/Zulu",
"Etc/Universal|UTC",
"Etc/Universal|Universal",
"Etc/Universal|Zulu",
"Etc/UTC|Etc/Universal",
"Etc/UTC|Etc/Zulu",
"Etc/UTC|UTC",
"Etc/UTC|Universal",
"Etc/UTC|Zulu",
"Europe/Astrakhan|Europe/Ulyanovsk",
"Europe/Athens|Asia/Nicosia",
"Europe/Athens|EET",
Expand Down
16 changes: 8 additions & 8 deletions builds/moment-timezone-with-data.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### `0.5.16` _2018-04-18_
* Fixed Etc/UTC timezone recognition, updated tests. [#599](https://github.com/moment/moment-timezone/pull/599)

### `0.5.15` _2018-04-17_
* Updated data to IANA TZDB `2018d`. [#596](https://github.com/moment/moment-timezone/pull/596)

Expand Down
12 changes: 6 additions & 6 deletions data/packed/2018d.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
"Etc/GMT+8|-08|80|0|",
"Etc/GMT+9|-09|90|0|",
"Etc/UCT|UCT|0|0|",
"Etc/Universal|UTC|0|0|",
"Etc/UTC|UTC|0|0|",
"Europe/Amsterdam|AMT NST +0120 +0020 CEST CET|-j.w -1j.w -1k -k -20 -10|010101010101010101010101010101010101010101012323234545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545|-2aFcj.w 11b0 1iP0 11A0 1io0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1co0 1io0 1yo0 Pc0 1a00 1fA0 1Bc0 Mo0 1tc0 Uo0 1tA0 U00 1uo0 W00 1s00 VA0 1so0 Vc0 1sM0 UM0 1wo0 Rc0 1u00 Wo0 1rA0 W00 1s00 VA0 1sM0 UM0 1w00 fV0 BCX.w 1tA0 U00 1u00 Wo0 1sm0 601k WM0 1fA0 1cM0 1cM0 1cM0 16M0 1gMM0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|16e5",
"Europe/Andorra|WET CET CEST|0 -10 -20|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-UBA0 1xIN0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|79e3",
"Europe/Astrakhan|LMT +03 +04 +05|-3c.c -30 -40 -50|012323232323232323212121212121212121212121212121212121212121212|-1Pcrc.c eUMc.c 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0",
Expand Down Expand Up @@ -540,11 +540,11 @@
"Etc/GMT-0|GMT0",
"Etc/GMT-0|Greenwich",
"Etc/UCT|UCT",
"Etc/Universal|Etc/UTC",
"Etc/Universal|Etc/Zulu",
"Etc/Universal|UTC",
"Etc/Universal|Universal",
"Etc/Universal|Zulu",
"Etc/UTC|Etc/Universal",
"Etc/UTC|Etc/Zulu",
"Etc/UTC|UTC",
"Etc/UTC|Universal",
"Etc/UTC|Zulu",
"Europe/Belgrade|Europe/Ljubljana",
"Europe/Belgrade|Europe/Podgorica",
"Europe/Belgrade|Europe/Sarajevo",
Expand Down
12 changes: 6 additions & 6 deletions data/packed/latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
"Etc/GMT+8|-08|80|0|",
"Etc/GMT+9|-09|90|0|",
"Etc/UCT|UCT|0|0|",
"Etc/Universal|UTC|0|0|",
"Etc/UTC|UTC|0|0|",
"Europe/Amsterdam|AMT NST +0120 +0020 CEST CET|-j.w -1j.w -1k -k -20 -10|010101010101010101010101010101010101010101012323234545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545|-2aFcj.w 11b0 1iP0 11A0 1io0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1co0 1io0 1yo0 Pc0 1a00 1fA0 1Bc0 Mo0 1tc0 Uo0 1tA0 U00 1uo0 W00 1s00 VA0 1so0 Vc0 1sM0 UM0 1wo0 Rc0 1u00 Wo0 1rA0 W00 1s00 VA0 1sM0 UM0 1w00 fV0 BCX.w 1tA0 U00 1u00 Wo0 1sm0 601k WM0 1fA0 1cM0 1cM0 1cM0 16M0 1gMM0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|16e5",
"Europe/Andorra|WET CET CEST|0 -10 -20|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-UBA0 1xIN0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|79e3",
"Europe/Astrakhan|LMT +03 +04 +05|-3c.c -30 -40 -50|012323232323232323212121212121212121212121212121212121212121212|-1Pcrc.c eUMc.c 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0",
Expand Down Expand Up @@ -540,11 +540,11 @@
"Etc/GMT-0|GMT0",
"Etc/GMT-0|Greenwich",
"Etc/UCT|UCT",
"Etc/Universal|Etc/UTC",
"Etc/Universal|Etc/Zulu",
"Etc/Universal|UTC",
"Etc/Universal|Universal",
"Etc/Universal|Zulu",
"Etc/UTC|Etc/Universal",
"Etc/UTC|Etc/Zulu",
"Etc/UTC|UTC",
"Etc/UTC|Universal",
"Etc/UTC|Zulu",
"Europe/Belgrade|Europe/Ljubljana",
"Europe/Belgrade|Europe/Podgorica",
"Europe/Belgrade|Europe/Sarajevo",
Expand Down
16 changes: 9 additions & 7 deletions moment-timezone-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! moment-timezone-utils.js
//! version : 0.5.15
//! version : 0.5.16
//! Copyright (c) JS Foundation and other contributors
//! license : MIT
//! github.com/moment/moment-timezone
Expand Down Expand Up @@ -172,7 +172,7 @@
return arraysAreEqual(a.offsets, b.offsets) && arraysAreEqual(a.abbrs, b.abbrs) && arraysAreEqual(a.untils, b.untils);
}

function findAndCreateLinks (input, output, links) {
function findAndCreateLinks (input, output, links, groupLeaders) {
var i, j, a, b, group, foundGroup, groups = [];

for (i = 0; i < input.length; i++) {
Expand All @@ -185,7 +185,9 @@
if (zonesAreEqual(a, b)) {
if (a.population > b.population) {
group.unshift(a);
} else {
} else if (a.population === b.population && groupLeaders && groupLeaders[a.name]) {
group.unshift(a);
} else {
group.push(a);
}
foundGroup = true;
Expand All @@ -206,15 +208,15 @@
}
}

function createLinks (source) {
function createLinks (source, groupLeaders) {
var zones = [],
links = [];

if (source.links) {
links = source.links.slice();
}

findAndCreateLinks(source.zones, zones, links);
findAndCreateLinks(source.zones, zones, links, groupLeaders);

return {
version : source.version,
Expand Down Expand Up @@ -279,7 +281,7 @@
Filter, Link, and Pack
************************************/

function filterLinkPack (input, start, end) {
function filterLinkPack (input, start, end, groupLeaders) {
var i,
inputZones = input.zones,
outputZones = [],
Expand All @@ -293,7 +295,7 @@
zones : outputZones,
links : input.links.slice(),
version : input.version
});
}, groupLeaders);

for (i = 0; i < output.zones.length; i++) {
output.zones[i] = pack(output.zones[i]);
Expand Down
4 changes: 2 additions & 2 deletions moment-timezone.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! moment-timezone.js
//! version : 0.5.15
//! version : 0.5.16
//! Copyright (c) JS Foundation and other contributors
//! license : MIT
//! github.com/moment/moment-timezone
Expand All @@ -24,7 +24,7 @@
// return moment;
// }

var VERSION = "0.5.15",
var VERSION = "0.5.16",
zones = {},
links = {},
names = {},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moment-timezone",
"version": "0.5.15",
"version": "0.5.16",
"description": "Parse and display moments in any timezone.",
"homepage": "http://momentjs.com/timezone/",
"author": "Tim Wood <[email protected]> (http://timwoodcreates.com/)",
Expand Down
5 changes: 3 additions & 2 deletions tasks/builds.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use strict";

var tz = require('../moment-timezone-utils').tz;
var tz = require('../moment-timezone-utils').tz,
groupLeaders = require('./group-leaders.json');

module.exports = function (grunt) {
grunt.registerMultiTask('build', 'Build minified versions with data included.', function () {
Expand All @@ -18,7 +19,7 @@ module.exports = function (grunt) {
end = this.data[1];
}

data = tz.filterLinkPack(data, start, end);
data = tz.filterLinkPack(data, start, end, groupLeaders);
data = JSON.stringify(data, null, '\t');
data = data.split('\n').join('\n\t');
data = 'loadData(' + data + ');\n';
Expand Down
5 changes: 3 additions & 2 deletions tasks/data-pack.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"use strict";

var tz = require('../moment-timezone-utils').tz;
var tz = require('../moment-timezone-utils').tz,
groupLeaders = require('./group-leaders.json');

module.exports = function (grunt) {
grunt.registerTask('data-pack', '6. Pack data from data-dedupe.', function (version) {
version = version || 'latest';

var unpacked = grunt.file.readJSON('data/unpacked/' + version + '.json'),
output = tz.createLinks(unpacked);
output = tz.createLinks(unpacked, groupLeaders);

output.zones = output.zones.map(function (unpacked) {
return tz.pack(unpacked);
Expand Down
Loading

0 comments on commit e0cf4dc

Please sign in to comment.