Skip to content

Commit

Permalink
Merge pull request #242 from iLib-js/fixTZGen
Browse files Browse the repository at this point in the history
Fix a problem in the time zone info generation
  • Loading branch information
ehoogerbeets authored Mar 25, 2020
2 parents d54e189 + b0bc19a commit 78ba9bd
Show file tree
Hide file tree
Showing 47 changed files with 475 additions and 243 deletions.
5 changes: 5 additions & 0 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ New Features:
* updated methods are: getDisplayName, getOffset, getOffsetStr,
getOffsetMillis, and inDaylightTime

Bug Fixes:
* Time zones in Indiana, Kentucky, North Dakota, and Argentina were missing.
Fixed the zone info compiler to generate the json data for these missing time
zones properly.

Build 008
-------
Published as version 14.5.0
Expand Down
12 changes: 8 additions & 4 deletions java/src/com/ilib/tools/zic/JsonZoneWriter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* JsonZoneWriter.java -
*
* Copyright © 2014 JEDLSoft, All Rights Reserved.
* Copyright © 2014, 2020 JEDLSoft, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -46,6 +46,11 @@ public JsonZoneWriter(File file)
this.outputDir = file;
}

/**
* @param zoneName
* @param json
* @throws Exception
*/
public void writeZone(String zoneName, JSONObject json)
throws Exception
{
Expand All @@ -54,9 +59,8 @@ public void writeZone(String zoneName, JSONObject json)
return;
}
Writer writer = null;
String[] parts = zoneName.split("/");
File dir = parts.length > 1 ? new File(outputDir, parts[0]) : outputDir;
File file = new File(dir, (parts.length > 1 ? parts[1] : zoneName) + ".json");
File file = new File(outputDir, zoneName + ".json");
File dir = file.getParentFile();
try {
if ( !dir.exists() ) {
logger.trace("Making new dir " + dir.getPath());
Expand Down
11 changes: 7 additions & 4 deletions java/src/com/ilib/tools/zic/Offset.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public JSONObject getJson(boolean currentOnly)
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
rulesList = rules.getRules();
Rule startRule = null, endRule = null;
Rule startRule = null, endRule = null, lastRule = rulesList.get(rulesList.size()-1);;
for ( i = 0; i < rulesList.size(); i++ ) {
rule = rulesList.get(i);
// check year-1 against the end year to take care of the
Expand Down Expand Up @@ -278,13 +278,16 @@ public JSONObject getJson(boolean currentOnly)
}
json.put("e", wallTime.getJson(currentOnly));
}

if ( startRule == null && endRule == null ) {

if (format.trim().equals("%s")) {
json.put("f", lastRule.getCharacter());
} else if ( startRule == null && endRule == null ) {
// no DST in this time zone, so fix up bogus abbreviations that include the %s when it shouldn't
// replace the %s with S for "Standard time"
json.put("f", format.replace("%s", "S"));
}
}

return json;
}
}
10 changes: 2 additions & 8 deletions js/data/locale/zoneinfo/Africa/Casablanca.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{
"e": {
"m": 6,
"r": "9",
"m": 5,
"r": "24",
"t": "2:0"
},
"f": "+01/+00",
"o": "1:0",
"s": {
"m": 6,
"r": "17",
"t": "2:0",
"v": "1:0"
},
"c": "MA",
"n": "Morocco {c} Time"
}
10 changes: 2 additions & 8 deletions js/data/locale/zoneinfo/Africa/El_Aaiun.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{
"e": {
"m": 6,
"r": "9",
"m": 5,
"r": "24",
"t": "2:0"
},
"f": "+01/+00",
"o": "1:0",
"s": {
"m": 6,
"r": "17",
"t": "2:0",
"v": "1:0"
},
"c": "EH",
"n": "Morocco {c} Time"
}
2 changes: 1 addition & 1 deletion js/data/locale/zoneinfo/Africa/Windhoek.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"f": "CAT",
"f": "WAT",
"o": "2:0",
"c": "NA",
"n": "Namibia {c} Time"
Expand Down
4 changes: 0 additions & 4 deletions js/data/locale/zoneinfo/America/Argentina.json

This file was deleted.

6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Buenos_Aires.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03/-02",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Catamarca.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
5 changes: 5 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/ComodRivadavia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Cordoba.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03/-02",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Jujuy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/La_Rioja.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Mendoza.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Rio_Gallegos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Salta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/San_Juan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/San_Luis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Tucuman.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03/-02",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
6 changes: 6 additions & 0 deletions js/data/locale/zoneinfo/America/Argentina/Ushuaia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"f": "-03",
"o": "-3:0",
"c": "AR",
"n": "Argentina {c} Time"
}
2 changes: 1 addition & 1 deletion js/data/locale/zoneinfo/America/Belize.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"f": "S",
"f": "CST",
"o": "-6:0",
"c": "BZ",
"n": "Central America {c} Time"
Expand Down
6 changes: 0 additions & 6 deletions js/data/locale/zoneinfo/America/Campo_Grande.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
},
"f": "-04/-03",
"o": "-4:0",
"s": {
"m": 11,
"r": "0>1",
"t": "0:0",
"v": "1:0"
},
"c": "BR",
"n": "Central Brazilian {c} Time"
}
6 changes: 0 additions & 6 deletions js/data/locale/zoneinfo/America/Cuiaba.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
},
"f": "-04/-03",
"o": "-4:0",
"s": {
"m": 11,
"r": "0>1",
"t": "0:0",
"v": "1:0"
},
"c": "BR",
"n": "Central Brazilian {c} Time"
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"e": {
"c": "S",
"m": 10,
"r": "l0",
"m": 11,
"r": "0>1",
"t": "2:0"
},
"f": "P{c}T",
"o": "-8:0",
"f": "E{c}T",
"o": "-5:0",
"s": {
"c": "D",
"m": 4,
"r": "0>1",
"m": 3,
"r": "0>8",
"t": "2:0",
"v": "1:0"
},
"c": "MX",
"n": "Pacific {c} Time (Mexico)"
"c": "US",
"n": "US Eastern {c} Time"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"r": "0>8",
"t": "2:0",
"v": "1:0"
}
},
"c": "US",
"n": "Central {c} Time"
}
19 changes: 19 additions & 0 deletions js/data/locale/zoneinfo/America/Indiana/Marengo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"e": {
"c": "S",
"m": 11,
"r": "0>1",
"t": "2:0"
},
"f": "E{c}T",
"o": "-5:0",
"s": {
"c": "D",
"m": 3,
"r": "0>8",
"t": "2:0",
"v": "1:0"
},
"c": "US",
"n": "US Eastern {c} Time"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"r": "0>8",
"t": "2:0",
"v": "1:0"
}
},
"c": "US",
"n": "Eastern {c} Time"
}
19 changes: 19 additions & 0 deletions js/data/locale/zoneinfo/America/Indiana/Tell_City.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"e": {
"c": "S",
"m": 11,
"r": "0>1",
"t": "2:0"
},
"f": "C{c}T",
"o": "-6:0",
"s": {
"c": "D",
"m": 3,
"r": "0>8",
"t": "2:0",
"v": "1:0"
},
"c": "US",
"n": "Central {c} Time"
}
19 changes: 19 additions & 0 deletions js/data/locale/zoneinfo/America/Indiana/Vevay.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"e": {
"c": "S",
"m": 11,
"r": "0>1",
"t": "2:0"
},
"f": "E{c}T",
"o": "-5:0",
"s": {
"c": "D",
"m": 3,
"r": "0>8",
"t": "2:0",
"v": "1:0"
},
"c": "US",
"n": "US Eastern {c} Time"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
"r": "0>8",
"t": "2:0",
"v": "1:0"
}
},
"c": "US",
"n": "Eastern {c} Time"
}
Loading

0 comments on commit 78ba9bd

Please sign in to comment.