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

Record view / Invalid timezone shift for years outside moment's 10 years range #7553

Merged
merged 1 commit into from Jan 4, 2024

Conversation

josegar74
Copy link
Member

Replacement of #6606 that doesn't fix the issue properly.

This change replaces moment-timezone-with-data-10-year-range.min.js with moment-timezone-with-data-1970-2030.min.js version 0.5.43.

For catalogues with metadata containing dates before 1970, consider to use https://momentjs.com/downloads/moment-timezone-with-data.min.js

Test case:

  1. Import the following metadata file.

test-metadata.txt

  1. In the record view, check the dates are displayed with the same values as in the XML. Without the fix some dates are not correctly displayed. eg. 2014-10-05 is displayed as 2014-10-04 when timezone is CET.

For a long term solution, should be investigated the usage of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat or other libraries.

Checklist

  • I have read the [contribution guidelines](https://github.com/geonetwork/core-geonetwork/blob/main/CONTRIBUTING.md
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests)
  • User documentation provided for new features or enhancements in mannual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

…ars range.

Use moment-timezone-with-data-1970-2030.min.js version 0.5.43. For catalogues with  metadata containing dates before 1970, consider to use https://momentjs.com/downloads/moment-timezone-with-data.min.js
@jahow
Copy link
Contributor

jahow commented Dec 14, 2023

It looks like the new file is ~130kb compared to the old one that was ~40kb; have you estimated the impact on the size of the final bundle?

@josegar74
Copy link
Member Author

josegar74 commented Dec 14, 2023

@jahow the problem is that with the current bundle, dates are displayed incorrectly if are outside of the internal +-5 years.

Not nice to have that size increase, but better than displaying wrong dates, at least for the short term. For the long term we should check for alternatives to replace momentjs.

@fxprunayre fxprunayre merged commit c67946d into geonetwork:main Jan 4, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants