Skip to content

Commit

Permalink
7.4.0rc
Browse files Browse the repository at this point in the history
  • Loading branch information
spencermountain committed Dec 30, 2022
1 parent f030614 commit e1bbc20
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 71 deletions.
34 changes: 20 additions & 14 deletions builds/spacetime.cjs
@@ -1,4 +1,4 @@
/* spencermountain/spacetime 7.3.0 Apache 2.0 */
/* spencermountain/spacetime 7.4.0 Apache 2.0 */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -80,10 +80,8 @@
"3|n|03/26:02->10/29:03": "8/chisinau,8/tiraspol",
"3|n|03/26:00->10/28:24": "2/beirut",
"3|n|03/25:02->10/28:02": "2/gaza,2/hebron",
"3|n|03/25:00->10/27:24": "2/damascus",
"3|n|03/24:02->10/29:02": "2/jerusalem,2/tel_aviv,israel",
"3|n|02/25:00->10/28:01": "2/amman",
"3|n": "0/addis_ababa,0/asmara,0/asmera,0/dar_es_salaam,0/djibouti,0/juba,0/kampala,0/mogadishu,0/nairobi,2/aden,2/baghdad,2/bahrain,2/kuwait,2/qatar,2/riyadh,8/istanbul,8/kirov,8/minsk,8/moscow,8/simferopol,9/comoro,9/mayotte,2/istanbul,turkey,w-su",
"3|n": "0/addis_ababa,0/asmara,0/asmera,0/dar_es_salaam,0/djibouti,0/juba,0/kampala,0/mogadishu,0/nairobi,2/aden,2/amman,2/baghdad,2/bahrain,2/damascus,2/kuwait,2/qatar,2/riyadh,8/istanbul,8/kirov,8/minsk,8/moscow,8/simferopol,9/comoro,9/mayotte,2/istanbul,turkey,w-su",
"2|s|03/26:02->10/29:02": "12/troll",
"2|s": "0/gaborone,0/harare,0/johannesburg,0/lubumbashi,0/lusaka,0/maputo,0/maseru,0/mbabane",
"2|n|03/26:02->10/29:03": "0/ceuta,arctic/longyearbyen,8/amsterdam,8/andorra,8/belgrade,8/berlin,8/bratislava,8/brussels,8/budapest,8/busingen,8/copenhagen,8/gibraltar,8/ljubljana,8/luxembourg,8/madrid,8/malta,8/monaco,8/oslo,8/paris,8/podgorica,8/prague,8/rome,8/san_marino,8/sarajevo,8/skopje,8/stockholm,8/tirane,8/vaduz,8/vatican,8/vienna,8/warsaw,8/zagreb,8/zurich,3/jan_mayen,poland",
Expand All @@ -96,7 +94,7 @@
"13|s": "11/apia,11/tongatapu",
"13|n": "11/enderbury,11/kanton,11/fakaofo",
"12|s|04/02:03->09/24:02": "12/mcmurdo,11/auckland,12/south_pole,nz",
"12|s|01/17:03->11/14:02": "11/fiji",
"12|s": "11/fiji",
"12|n": "2/anadyr,2/kamchatka,2/srednekolymsk,11/funafuti,11/kwajalein,11/majuro,11/nauru,11/tarawa,11/wake,11/wallis,kwajalein",
"12.75|s|04/02:03->04/02:02": "11/chatham,nz-chat",
"11|s|04/02:03->10/01:02": "12/macquarie",
Expand All @@ -117,14 +115,11 @@
"-7|n|03/12:02->11/05:02": "1/los_angeles,1/santa_isabel,1/tijuana,1/vancouver,1/ensenada,6/pacific,10/bajanorte,us/pacific-new,us/pacific",
"-7|n": "1/creston,1/dawson,1/dawson_creek,1/fort_nelson,1/hermosillo,1/phoenix,1/whitehorse,6/yukon,us/arizona",
"-6|s|04/01:22->09/02:22": "11/easter,7/easterisland",
"-6|n|04/03:02->10/30:02": "1/chihuahua,1/mazatlan,10/bajasur",
"-6|n|03/13:02->11/06:02": "1/ojinaga",
"-6|n|03/12:02->11/05:02": "1/boise,1/cambridge_bay,1/denver,1/edmonton,1/inuvik,1/north_dakota,1/yellowknife,1/shiprock,6/mountain,navajo,us/mountain",
"-6|n": "1/belize,1/costa_rica,1/el_salvador,1/guatemala,1/managua,1/regina,1/swift_current,1/tegucigalpa,11/galapagos,6/east-saskatchewan,6/saskatchewan",
"-6|n|03/12:02->11/05:02": "1/boise,1/cambridge_bay,1/denver,1/edmonton,1/inuvik,1/north_dakota,1/ojinaga,1/yellowknife,1/shiprock,6/mountain,navajo,us/mountain",
"-6|n": "1/belize,1/chihuahua,1/costa_rica,1/el_salvador,1/guatemala,1/managua,1/mazatlan,1/regina,1/swift_current,1/tegucigalpa,11/galapagos,6/east-saskatchewan,6/saskatchewan,10/bajasur",
"-5|s": "1/lima,1/rio_branco,1/porto_acre,5/acre",
"-5|n|04/03:02->10/30:02": "1/bahia_banderas,1/merida,1/mexico_city,1/monterrey,10/general",
"-5|n|03/12:02->11/05:02": "1/chicago,1/matamoros,1/menominee,1/rainy_river,1/rankin_inlet,1/resolute,1/winnipeg,1/indiana/knox,1/indiana/tell_city,1/north_dakota/beulah,1/north_dakota/center,1/north_dakota/new_salem,1/knox_in,6/central,us/central,us/indiana-starke",
"-5|n": "1/bogota,1/cancun,1/cayman,1/coral_harbour,1/eirunepe,1/guayaquil,1/jamaica,1/panama,1/atikokan,jamaica",
"-5|n": "1/bahia_banderas,1/bogota,1/cancun,1/cayman,1/coral_harbour,1/eirunepe,1/guayaquil,1/jamaica,1/merida,1/mexico_city,1/monterrey,1/panama,1/atikokan,jamaica,10/general",
"-4|s|04/01:24->09/03:00": "1/santiago,7/continental",
"-4|s|03/25:24->10/01:00": "1/asuncion",
"-4|s": "1/campo_grande,1/cuiaba,1/la_paz,1/manaus,5/west",
Expand Down Expand Up @@ -1519,6 +1514,7 @@
'millisecond-pad': (s) => zeroPad(s.millisecond(), 3),

ampm: (s) => s.ampm(),
AMPM: (s) => s.ampm().toUpperCase(),
quarter: (s) => 'Q' + s.quarter(),
season: (s) => s.season(),
era: (s) => s.era(),
Expand Down Expand Up @@ -1608,7 +1604,7 @@
let out = format[str](s) || '';
if (str !== 'json') {
out = String(out);
if (str !== 'ampm') {
if (str.toLowerCase() !== 'ampm') {
out = applyCaseFormat(out);
}
}
Expand All @@ -1621,7 +1617,7 @@
fmt = fmt.toLowerCase().trim();
if (format.hasOwnProperty(fmt)) {
let out = String(format[fmt](s));
if (fmt !== 'ampm') {
if (fmt.toLowerCase() !== 'ampm') {
return applyCaseFormat(out)
}
return out
Expand Down Expand Up @@ -1927,6 +1923,10 @@
tmp = a.add(obj.months, 'month');
obj.months += diffOne$1(tmp, b, 'month');

// there's always 4 quarters in a year...
obj.quarters = obj.years * 4;
obj.quarters += parseInt((obj.months % 12) / 3, 10);

// there's always atleast 52 weeks in a year..
// (month * 4) isn't as close
obj.weeks = obj.years * 52;
Expand Down Expand Up @@ -2195,6 +2195,12 @@
];

const units$1 = {
second: (s) => {
walkTo$1(s, {
millisecond: 0
});
return s
},
minute: (s) => {
walkTo$1(s, {
second: 0,
Expand Down Expand Up @@ -4009,7 +4015,7 @@
};
var whereIts$1 = whereIts;

var version = '7.3.0';
var version = '7.4.0';

const main = (input, tz, options) => new Spacetime(input, tz, options);

Expand Down
2 changes: 1 addition & 1 deletion builds/spacetime.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion builds/spacetime.mjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions changelog.md
Expand Up @@ -9,6 +9,13 @@ This project follows semVer, where:
-->

### 7.4.0 [Dec 2022]
- **[update]** - 2023 DST changes for mexico
- **[update]** - 2023 DST changes for jordan
- **[update]** - 2023 DST changes for fiji
- **[update]** - missing seconds, quarters methods #360 #359
- **[new]** - {AMPM} uppercase fmt

### 7.3.0 [Dec 2022]
- **[update]** - 2023 DST changes
- **[fix]** - southern hemisphere december season #352
Expand Down
24 changes: 9 additions & 15 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "spacetime",
"version": "7.3.0",
"version": "7.4.0",
"description": "figure-out dates across timezones",
"main": "src/index.js",
"unpkg": "builds/spacetime.min.js",
Expand Down Expand Up @@ -60,4 +60,4 @@
"timekeeper": "2.2.0"
},
"license": "Apache-2.0"
}
}
4 changes: 3 additions & 1 deletion rollup.config.js
Expand Up @@ -3,8 +3,10 @@ import json from 'rollup-plugin-json'
import { terser } from 'rollup-plugin-terser'
import resolve from 'rollup-plugin-node-resolve'
import sizeCheck from 'rollup-plugin-filesize-check'
import { version } from './package.json'
import fs from 'fs'

let pkg = JSON.parse(fs.readFileSync('./package.json').toString())
let version = pkg.version
console.log('\n 📦 - running rollup..\n')

const banner = '/* spencermountain/spacetime ' + version + ' Apache 2.0 */'
Expand Down
2 changes: 1 addition & 1 deletion scripts/tz/build.js
Expand Up @@ -8,7 +8,7 @@ sh.config.silent = true
//i'm assuming theres no copyright on these things

//change this to generate a new one
const year = new Date().getFullYear()
const year = 2023//new Date().getFullYear()

const parseLine = (str) => {
let meta = {}
Expand Down
2 changes: 1 addition & 1 deletion src/_version.js
@@ -1 +1 @@
export default '7.3.0'
export default '7.4.0'
11 changes: 5 additions & 6 deletions test/dst-north.test.js
Expand Up @@ -12,19 +12,18 @@ let zones = [
'america/thunder_bay',
'america/nassau',
'asia/famagusta',
// 'america/indianapolis',
'america/tijuana', //11/01:02 -7hrs
'mexico/bajanorte', //11/01:02 -7hrs
'america/havana',
'america/indianapolis',
'america/menominee',
// 'america/tijuana', //11/01:02 -7hrs
// 'mexico/bajanorte', //11/01:02 -7hrs
// 'america/havana',
'america/indiana',
'america/kentucky',
'america/north_dakota',
'america/scoresbysund',
'asia/amman',
'asia/gaza',
'asia/hebron',
'atlantic/azores',
'asia/damascus', //10/29:24
'asia/beirut', //10/24:24
'asia/tehran' //09/20:24
]
Expand Down
8 changes: 4 additions & 4 deletions test/hemisphere.test.js
Expand Up @@ -15,7 +15,7 @@ test('toronto/Santiago same in june', (t) => {
t.equal(false, b.timezone().current.isDST, 'santiago not dst')
t.equal('South', b.hemisphere(), 'santiago in south')

t.ok(a.format('nice'), b.format('nice'), 'same-calendar-time')
t.ok(a.format('nice'), b.format('nice'), 'same-calendar-time1')
t.end()
})

Expand All @@ -36,14 +36,14 @@ test('toronto/Santiago -2hrs in january', (t) => {
test('northern-hemisphere spring-ahead', (t) => {
//regina is always -6, mexico city goes -5 in the summer (dst+1)
//so both are -6 in january
let jan1 = spacetime('January 21, 2017 20:42:00', 'America/Mexico_City')
let jan1 = spacetime('January 21, 2017 20:42:00', 'America/menominee')
let jan2 = jan1.clone().goto('America/Regina')
t.equal(jan1.format('nice'), jan2.format('nice'), 'same-calendar-time')
t.equal(jan1.format('nice'), jan2.format('nice'), 'same-calendar-time2')
t.equal(false, jan1.isDST(), 'Mexico_City-not-dst-in-january')
t.equal(false, jan2.isDST(), 'Regina-never-dst')

//not the same in september
let sep1 = spacetime('September 21, 2017 20:42:00', 'America/Mexico_City')
let sep1 = spacetime('September 21, 2017 20:42:00', 'America/menominee')
let sep2 = jan1.clone().goto('America/Regina')
t.notEqual(sep1.format('nice'), sep2.format('nice'), 'not-same-calendar-time-anymore')
t.equal(true, sep1.isDST(), 'Mexico_City-is-dst-in-sep')
Expand Down
15 changes: 5 additions & 10 deletions zonefile/_build.js
Expand Up @@ -25,10 +25,8 @@ export default {
"3|n|03/26:02->10/29:03": "8/chisinau,8/tiraspol",
"3|n|03/26:00->10/28:24": "2/beirut",
"3|n|03/25:02->10/28:02": "2/gaza,2/hebron",
"3|n|03/25:00->10/27:24": "2/damascus",
"3|n|03/24:02->10/29:02": "2/jerusalem,2/tel_aviv,israel",
"3|n|02/25:00->10/28:01": "2/amman",
"3|n": "0/addis_ababa,0/asmara,0/asmera,0/dar_es_salaam,0/djibouti,0/juba,0/kampala,0/mogadishu,0/nairobi,2/aden,2/baghdad,2/bahrain,2/kuwait,2/qatar,2/riyadh,8/istanbul,8/kirov,8/minsk,8/moscow,8/simferopol,9/comoro,9/mayotte,2/istanbul,turkey,w-su",
"3|n": "0/addis_ababa,0/asmara,0/asmera,0/dar_es_salaam,0/djibouti,0/juba,0/kampala,0/mogadishu,0/nairobi,2/aden,2/amman,2/baghdad,2/bahrain,2/damascus,2/kuwait,2/qatar,2/riyadh,8/istanbul,8/kirov,8/minsk,8/moscow,8/simferopol,9/comoro,9/mayotte,2/istanbul,turkey,w-su",
"2|s|03/26:02->10/29:02": "12/troll",
"2|s": "0/gaborone,0/harare,0/johannesburg,0/lubumbashi,0/lusaka,0/maputo,0/maseru,0/mbabane",
"2|n|03/26:02->10/29:03": "0/ceuta,arctic/longyearbyen,8/amsterdam,8/andorra,8/belgrade,8/berlin,8/bratislava,8/brussels,8/budapest,8/busingen,8/copenhagen,8/gibraltar,8/ljubljana,8/luxembourg,8/madrid,8/malta,8/monaco,8/oslo,8/paris,8/podgorica,8/prague,8/rome,8/san_marino,8/sarajevo,8/skopje,8/stockholm,8/tirane,8/vaduz,8/vatican,8/vienna,8/warsaw,8/zagreb,8/zurich,3/jan_mayen,poland",
Expand All @@ -41,7 +39,7 @@ export default {
"13|s": "11/apia,11/tongatapu",
"13|n": "11/enderbury,11/kanton,11/fakaofo",
"12|s|04/02:03->09/24:02": "12/mcmurdo,11/auckland,12/south_pole,nz",
"12|s|01/17:03->11/14:02": "11/fiji",
"12|s": "11/fiji",
"12|n": "2/anadyr,2/kamchatka,2/srednekolymsk,11/funafuti,11/kwajalein,11/majuro,11/nauru,11/tarawa,11/wake,11/wallis,kwajalein",
"12.75|s|04/02:03->04/02:02": "11/chatham,nz-chat",
"11|s|04/02:03->10/01:02": "12/macquarie",
Expand All @@ -62,14 +60,11 @@ export default {
"-7|n|03/12:02->11/05:02": "1/los_angeles,1/santa_isabel,1/tijuana,1/vancouver,1/ensenada,6/pacific,10/bajanorte,us/pacific-new,us/pacific",
"-7|n": "1/creston,1/dawson,1/dawson_creek,1/fort_nelson,1/hermosillo,1/phoenix,1/whitehorse,6/yukon,us/arizona",
"-6|s|04/01:22->09/02:22": "11/easter,7/easterisland",
"-6|n|04/03:02->10/30:02": "1/chihuahua,1/mazatlan,10/bajasur",
"-6|n|03/13:02->11/06:02": "1/ojinaga",
"-6|n|03/12:02->11/05:02": "1/boise,1/cambridge_bay,1/denver,1/edmonton,1/inuvik,1/north_dakota,1/yellowknife,1/shiprock,6/mountain,navajo,us/mountain",
"-6|n": "1/belize,1/costa_rica,1/el_salvador,1/guatemala,1/managua,1/regina,1/swift_current,1/tegucigalpa,11/galapagos,6/east-saskatchewan,6/saskatchewan",
"-6|n|03/12:02->11/05:02": "1/boise,1/cambridge_bay,1/denver,1/edmonton,1/inuvik,1/north_dakota,1/ojinaga,1/yellowknife,1/shiprock,6/mountain,navajo,us/mountain",
"-6|n": "1/belize,1/chihuahua,1/costa_rica,1/el_salvador,1/guatemala,1/managua,1/mazatlan,1/regina,1/swift_current,1/tegucigalpa,11/galapagos,6/east-saskatchewan,6/saskatchewan,10/bajasur",
"-5|s": "1/lima,1/rio_branco,1/porto_acre,5/acre",
"-5|n|04/03:02->10/30:02": "1/bahia_banderas,1/merida,1/mexico_city,1/monterrey,10/general",
"-5|n|03/12:02->11/05:02": "1/chicago,1/matamoros,1/menominee,1/rainy_river,1/rankin_inlet,1/resolute,1/winnipeg,1/indiana/knox,1/indiana/tell_city,1/north_dakota/beulah,1/north_dakota/center,1/north_dakota/new_salem,1/knox_in,6/central,us/central,us/indiana-starke",
"-5|n": "1/bogota,1/cancun,1/cayman,1/coral_harbour,1/eirunepe,1/guayaquil,1/jamaica,1/panama,1/atikokan,jamaica",
"-5|n": "1/bahia_banderas,1/bogota,1/cancun,1/cayman,1/coral_harbour,1/eirunepe,1/guayaquil,1/jamaica,1/merida,1/mexico_city,1/monterrey,1/panama,1/atikokan,jamaica,10/general",
"-4|s|04/01:24->09/03:00": "1/santiago,7/continental",
"-4|s|03/25:24->10/01:00": "1/asuncion",
"-4|s": "1/campo_grande,1/cuiaba,1/la_paz,1/manaus,5/west",
Expand Down
21 changes: 6 additions & 15 deletions zonefile/iana.js
Expand Up @@ -256,7 +256,6 @@ export default {
"america/bahia_banderas": {
"offset": -5,
"hem": "n",
"dst": "04/03:02->10/30:02"
},
"america/barbados": {
"offset": -4,
Expand Down Expand Up @@ -328,7 +327,6 @@ export default {
"america/chihuahua": {
"offset": -6,
"hem": "n",
"dst": "04/03:02->10/30:02"
},
"america/coral_harbour": {
"offset": -5,
Expand Down Expand Up @@ -546,8 +544,7 @@ export default {
},
"america/mazatlan": {
"offset": -6,
"hem": "n",
"dst": "04/03:02->10/30:02"
"hem": "n"
},
"america/mendoza": {
"offset": -3,
Expand All @@ -560,8 +557,7 @@ export default {
},
"america/merida": {
"offset": -5,
"hem": "n",
"dst": "04/03:02->10/30:02"
"hem": "n"
},
"america/metlakatla": {
"offset": -8,
Expand All @@ -570,8 +566,7 @@ export default {
},
"america/mexico_city": {
"offset": -5,
"hem": "n",
"dst": "04/03:02->10/30:02"
"hem": "n"
},
"america/miquelon": {
"offset": -2,
Expand All @@ -586,7 +581,6 @@ export default {
"america/monterrey": {
"offset": -5,
"hem": "n",
"dst": "04/03:02->10/30:02"
},
"america/montevideo": {
"offset": -3,
Expand Down Expand Up @@ -633,7 +627,7 @@ export default {
"america/ojinaga": {
"offset": -6,
"hem": "n",
"dst": "03/13:02->11/06:02"
"dst": "03/12:02->11/05:02"
},
"america/panama": {
"offset": -5,
Expand Down Expand Up @@ -877,7 +871,6 @@ export default {
"asia/amman": {
"offset": 3,
"hem": "n",
"dst": "02/25:00->10/28:01"
},
"asia/anadyr": {
"offset": 12,
Expand Down Expand Up @@ -950,8 +943,7 @@ export default {
},
"asia/damascus": {
"offset": 3,
"hem": "n",
"dst": "03/25:00->10/27:24"
"hem": "n"
},
"asia/dhaka": {
"offset": 6,
Expand Down Expand Up @@ -1685,8 +1677,7 @@ export default {
},
"pacific/fiji": {
"offset": 12,
"hem": "s",
"dst": "01/17:03->11/14:02"
"hem": "s"
},
"pacific/funafuti": {
"offset": 12,
Expand Down

0 comments on commit e1bbc20

Please sign in to comment.