| 1 | import moment = require('../moment-timezone-utils'); |
| 2 | |
| 3 | const ZONE_A: moment.UnpackedZone = { |
| 4 | name : "Test/A", |
| 5 | abbrs : ["ABC", "DEF", "GHI"], |
| 6 | offsets : [10, 20, 30], |
| 7 | untils : [-1000, 100, 200], |
| 8 | population : 2000 |
| 9 | }; |
| 10 | |
| 11 | const ZONE_B = { |
| 12 | name : "Test/B", |
| 13 | abbrs : ["ABC", "DEF", "GHI"], |
| 14 | offsets : [10, 20, 30], |
| 15 | untils : [-1000, 100, 200], |
| 16 | population : 0 |
| 17 | }; |
| 18 | |
| 19 | const ZONE_C = { |
| 20 | name : "Test/C", |
| 21 | abbrs : ["ZYX", "WVU"], |
| 22 | offsets : [20, 30], |
| 23 | untils : [-3000, 900] |
| 24 | }; |
| 25 | |
| 26 | const unpackedBundle: moment.UnpackedZoneBundle = { |
| 27 | zones : [ZONE_A, ZONE_B, ZONE_C], |
| 28 | links : ["Test/A|Test/B", "Test/A|Test/C"], |
| 29 | version : '2025test' |
| 30 | } |
| 31 | |
| 32 | const packedZone: string = moment.tz.pack(ZONE_A); |
| 33 | const packedNum: string = moment.tz.packBase60(12345678); |
| 34 | |
| 35 | const packedBundle: moment.PackedZoneBundle = moment.tz.createLinks(unpackedBundle); |
| 36 | const packedCountry: string = moment.tz.packCountry({ |
| 37 | name: 'PG', |
| 38 | zones: ['Pacific/Port_Moresby', 'Pacific/Bougainville'] |
| 39 | }); |
| 40 | |
| 41 | const filtered1: moment.UnpackedZone = moment.tz.filterYears(ZONE_A, 2025); |
| 42 | const filtered2: moment.UnpackedZone = moment.tz.filterYears(ZONE_A, 1970, 2038); |
| 43 | |
| 44 | const all1: moment.PackedZoneBundle = moment.tz.filterLinkPack(unpackedBundle, 2025); |
| 45 | const all2: moment.PackedZoneBundle = moment.tz.filterLinkPack(unpackedBundle, 1970, 2038); |