Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace node-time with moment-timezone #24

Merged

Conversation

gustavnikolaj
Copy link
Contributor

@gustavnikolaj gustavnikolaj commented Aug 20, 2020

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 prantlf/timezone-support#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.

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:

```js
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));
```
@papandreou papandreou merged commit ac146dc into papandreou:master Aug 20, 2020
@gustavnikolaj gustavnikolaj deleted the feature/replace-time-module branch August 20, 2020 15:43
@papandreou
Copy link
Owner

Released in 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants