Skip to content

Commit

Permalink
Fix Intl data splicing bug, update ΔT. (#24)
Browse files Browse the repository at this point in the history
* Fix bug in splicing Intl-derived timezone transitions onto tabularly-defined data.
* Update 2022 estimated ΔT.
  • Loading branch information
kshetline authored Nov 21, 2021
1 parent 5475c85 commit 1bb4f41
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tubular/time",
"version": "3.7.3",
"version": "3.7.4",
"description": "Date/time, IANA timezones, leap seconds, TAI/UTC conversions, calendar with settable Julian/Gregorian switchover",
"main": "dist/cjs/index.js",
"module": "dist/fesm2015/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/timezone-large-alt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const timezoneLargeAlt = /* trim-file-start */{ // tz database version: 2021e, years 1800-2088, rounded to nearest minute, filtered, calendar rollbacks eliminated
version: '2021e',
years: '1800-2088',
deltaTs: '69.36 69.36 69.45',
deltaTs: '69.36 69.36 69.28',
leapSeconds: '912 1096 1461 1826 2191 2557 2922 3287 3652 4199 4564 4929 5660 6574 7305 7670 8217 8582 8947 9496 10043 10592 13149 14245 15522 16617 17167',
'Africa/Abidjan': '-0016 +0000 0;-g/0/LMT 0/0/GMT;1;-2ldXI;;48e5;BFCIGMGNMLMRSHSLSNTG',
'Africa/Algiers': '+0012 +0100 0;c/0/LMT 9/0/PMT 0/0/WET 10/10/WEST 10/0/CET 20/10/CEST;1232323232323232454542423234542324;-3bQ0c MDA3 cNb9 HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 DA0 Imo0 rd0 De0 9Xz0 1fb0 1ap0 16K0 2yo0 mEp0 hwL0 jxA0 11A0 dDd0 17b0 11B0 1cN0 2Dy0 1cN0 1fB0 1cL0;;26e5;DZ',
Expand Down
2 changes: 1 addition & 1 deletion src/timezone-large.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const timezoneLarge = /* trim-file-start */{ // tz database version: 2021e, years 1800-2088
version: '2021e',
years: '1800-2088',
deltaTs: '69.36 69.36 69.45',
deltaTs: '69.36 69.36 69.28',
leapSeconds: '912 1096 1461 1826 2191 2557 2922 3287 3652 4199 4564 4929 5660 6574 7305 7670 8217 8582 8947 9496 10043 10592 13149 14245 15522 16617 17167',
'Africa/Abidjan': '-001608 +0000 0;-g.8/0/LMT 0/0/GMT;1;-2ldXH.Q;;48e5;BFCIGMGNMLMRSHSLSNTG',
'Africa/Algiers': '+001212 +0100 0;c.c/0/LMT 9.l/0/PMT 0/0/WET 10/10/WEST 10/0/CET 20/10/CEST;1232323232323232454542423234542324;-3bQ0c.c MDA2.P cNb9.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 DA0 Imo0 rd0 De0 9Xz0 1fb0 1ap0 16K0 2yo0 mEp0 hwL0 jxA0 11A0 dDd0 17b0 11B0 1cN0 2Dy0 1cN0 1fB0 1cL0;;26e5;DZ',
Expand Down
2 changes: 1 addition & 1 deletion src/timezone-small.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const timezoneSmall = /* trim-file-start */{ // tz database version: 2021e, years 2016-2026
version: '2021e',
years: '2016-2026',
deltaTs: '69.36 69.36 69.45',
deltaTs: '69.36 69.36 69.28',
leapSeconds: '912 1096 1461 1826 2191 2557 2922 3287 3652 4199 4564 4929 5660 6574 7305 7670 8217 8582 8947 9496 10043 10592 13149 14245 15522 16617 17167',
'Africa/Abidjan': '+0000 +0000 0;0/0/GMT;;;;48e5;BFCIGMGNMLMRSHSLSNTG',
'Africa/Algiers': '+0100 +0100 0;10/0/CET;;;;26e5;DZ',
Expand Down
4 changes: 2 additions & 2 deletions src/timezone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,10 +880,10 @@ export class Timezone {
if (insertTransitions.length > 0) {
// Make sure first added transition isn't to standard time.
if (fromRules && insertTransitions.length > 1 && insertTransitions[0].dstOffset === 0 &&
insertTransitions[0].dstOffset !== 0)
insertTransitions[1].dstOffset !== 0)
insertTransitions.splice(0, 1);

// Make sure first added transition IS to standard time, and doesn't overlap already-created transitions.
// Make sure last added transition IS to standard time, and doesn't overlap already-created transitions.
while (insertTransitions.length > 0 && last(insertTransitions).dstOffset !== 0 ||
last(insertTransitions).transitionTime >= transitions[1].transitionTime)
insertTransitions.splice(insertTransitions.length - 1, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/ut-converter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const TEST_DTS = [
58.45, 59.19, 59.92, 60.68, 61.46, 62.23, 62.90, 63.42, 63.81, 64.08,
64.27, 64.41, 64.55, 64.73, 64.95, 65.20, 65.48, 65.77, 66.06, 66.33,
66.61, 66.92, 67.28, 67.69, 68.11, 68.53, 68.92, 69.24, 69.36, 69.36,
69.45
69.28
];

describe('UT/TDT Converter', () => {
Expand Down
9 changes: 6 additions & 3 deletions src/ut-converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ const baseHistoricDeltaT = [
66.06, 66.33, 66.61, 66.92, 67.28, 67.69, 68.11, 68.53, 68.92, 69.24

// From 2020 onward, data from timezone files, via updateDeltaTs().
// Get additional data from https://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html
// As ΔT = 32.184 (for TDT - TAI) + (TAI - UTC)† - (UT1-UTC)
// † 37 seconds on 2021-04-27, as will likely remain for some time.
// Additional data from https://datacenter.iers.org/data/latestVersion/finals.data.iau2000.txt,
// as linked to from https://www.iers.org/IERS/EN/DataProducts/EarthOrientationData/eop.html.
// ΔT = 32.184† + (TAI - UTC)‡ - (UT1 - UTC)§
// † TT - TAI (Terrestrial Time minus International Atomic Time), a constant value.
// ‡ 37 seconds as of 2021-11-21, as it will likely remain for some time.
// § From finals.data, numeric value starting at 59th character column.
];

let historicDeltaT = clone(baseHistoricDeltaT);
Expand Down

0 comments on commit 1bb4f41

Please sign in to comment.