papandreou / inter

A JavaScript locale library based on information extracted from the Unicode CLDR database
BSD 3-Clause "New" or "Revised" License
21 stars 5 forks source link

Replace node-time with moment-timezone #24

Closed gustavnikolaj closed 3 years ago

gustavnikolaj commented 3 years ago

I dumped the stringified JSON representation of zoneInfo.utcStandardOffsetSecondsByTimeZoneId into a file with the old implementation, and again with the new based on moment-timezone.

There is no diff between the two JSON files. Below is the example code used to generate them:

const ZoneInfo = require("./lib/ZoneInfo");
const ZoneInfoMoment = require("./lib/ZoneInfo-moment");

const zoneInfo = new ZoneInfo("/usr/share/zoneinfo");
const zoneInfoMoment = new ZoneInfoMoment("/usr/share/zoneinfo");

const fs = require('fs')

fs.writeFileSync('zoneInfoTime.json', JSON.stringify(zoneInfo.utcStandardOffsetSecondsByTimeZoneId, null, 2));
fs.writeFileSync('zoneInfoMoment.json', JSON.stringify(zoneInfoMoment.utcStandardOffsetSecondsByTimeZoneId, null, 2));

There was no specific tests of this module, but the build still works.

I wanted to use https://github.com/prantlf/timezone-support instead of moment-timezone, but due to https://github.com/prantlf/timezone-support/issues/33 and the fact that they do not have a way for us to tell if a date is DST, I had to go with moment.

papandreou commented 3 years ago

Released in 2.0.0