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

fix: switch to momentjs to handle timezones #436

Merged
merged 8 commits into from
Oct 23, 2019

Conversation

markov00
Copy link
Member

@markov00 markov00 commented Oct 22, 2019

Summary

The current used time library, Luxon is using Intl.DateTimeFormatter as the main source for handling time zones. That library depends on browsers implementation. IE11 doesn't have any timezone and it will need a polyfill.
This PR replace luxon with momentjs and moment-timezone. I'm leaving luxon as a devDependency on the tests and on stories. We can remove it in a future phase.

momentjs and moment-timezone are configured as peerDependency since Kibana is already using that library.

I've checked that fix cross-linking the build with Kibana. I've tested various timezones in Discover chart.

fix #428

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

  • Any consumer-facing exports were added to src/index.ts (and stories only import from ../src except for test data & storybook)
  • This was checked for cross-browser compatibility, including a check against IE11
  • Proper documentation or storybook story was added for features that require explanation or tutorials
  • Unit tests were updated or added to match the most common scenarios
  • Each commit follows the convention

@markov00
Copy link
Member Author

to be merged after #430

@codecov-io
Copy link

codecov-io commented Oct 22, 2019

Codecov Report

Merging #436 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #436      +/-   ##
==========================================
+ Coverage   97.87%   97.88%   +<.01%     
==========================================
  Files          40       41       +1     
  Lines        2921     2925       +4     
  Branches      706      708       +2     
==========================================
+ Hits         2859     2863       +4     
  Misses         55       55              
  Partials        7        7
Impacted Files Coverage Δ
src/utils/data/date_time.ts 100% <100%> (ø)
src/utils/scales/scale_continuous.ts 94.02% <100%> (ø) ⬆️
src/utils/data/formatters.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c2eae1...15cc232. Read the comment docs.

Copy link
Contributor

@rshen91 rshen91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense! Looks good and I like date_time.ts - helped clarify #430 for me 😅

Copy link
Collaborator

@nickofthyme nickofthyme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally with ALL kibana timezones with no issues. LGTM.

Just a few comments.

Screen Recording 2019-10-22 at 10 32 AM

package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
src/utils/data/date_time.ts Show resolved Hide resolved
src/utils/data/formatters.ts Outdated Show resolved Hide resolved
src/utils/data/formatters.ts Outdated Show resolved Hide resolved
yarn.lock Show resolved Hide resolved
Luxon use Init.DateTimeFormatter for handling timezones, but this is browser dependent. Moving to momentjs will allow us to be compliant to Kibana
@markov00 markov00 requested a review from nickofthyme October 22, 2019 20:06
@markov00
Copy link
Member Author

markov00 commented Oct 23, 2019

jenkins test this please

error on downloading nodejs

17:02:39  -- node: version=v10.15.2 dir=/var/lib/jenkins/.elastic-charts/node/10.15.2
17:02:39  -- setting up node.js
17:02:39  -- downloading node.js from https://nodejs.org/dist/v10.15.2/node-v10.15.2-linux-x64.tar.gz
17:07:51 
17:07:51 gzip: stdin: unexpected end of file
17:07:51 tar: Unexpected EOF in archive
17:07:51 tar: Unexpected EOF in archive
17:07:51 tar: Error is not recoverable: exiting now

@nickofthyme
Copy link
Collaborator

retest

@nickofthyme
Copy link
Collaborator

jenkins test this please

1 similar comment
@markov00
Copy link
Member Author

jenkins test this please

@markov00 markov00 merged commit a9f98c8 into elastic:master Oct 23, 2019
markov00 pushed a commit that referenced this pull request Oct 23, 2019
## [13.5.7](v13.5.6...v13.5.7) (2019-10-23)

### Bug Fixes

* switch to momentjs to handle timezones ([#436](#436)) ([a9f98c8](a9f98c8))
@markov00
Copy link
Member Author

🎉 This PR is included in version 13.5.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Oct 23, 2019
@markov00 markov00 deleted the add-momentjs branch November 25, 2020 11:43
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Issue released publicly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use all Kibana timezones in the timeZone prop
4 participants