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 moment.js #385

Closed
derneuere opened this issue Nov 5, 2021 · 3 comments
Closed

Replace moment.js #385

derneuere opened this issue Nov 5, 2021 · 3 comments
Labels
enhancement New feature or request frontend good first issue Good for newcomers

Comments

@derneuere
Copy link
Member

According to the project status there are more modern and lightweight solutions: https://momentjs.com/docs/#/-project-status/

We should consider replacing it with luxon https://moment.github.io/luxon/#/moment

@derneuere derneuere added enhancement New feature or request frontend labels Nov 5, 2021
@derneuere
Copy link
Member Author

I already added luxon to the frontend and used it in a couple of places. The rest is just applying it to the rest of the code base.

@derneuere derneuere added the good first issue Good for newcomers label Jan 15, 2022
@5m4u66y
Copy link
Contributor

5m4u66y commented Oct 16, 2022

I started to work on this issue, and I have a few questions.

  • What would be the best way to avoid i18n.resolvedLanguage.replace("_", "-") each time to get the current locale?
  • luxon does not provide ordinal suffix. Do we need to implement a way to restore them, or is it OK not to have suffixes like we had with moment.js? In my opinion we should stick without ordinal notation (https://www.editarians.com/cardinals-ordinals/)
  • regarding durations, luxon does not provide the nice "A few seconds ago" that moment.js has, and the toHuman function does not output a very good "humanized" string (see Duration#toHuman issue). For example for jobs duration, it outputs "xxxxx milliseconds". While moving to luxon, I would like to avoid adding another dependency to something like humanize-duration. Any suggestions?

@derneuere
Copy link
Member Author

derneuere commented Oct 16, 2022

  • At the moment, we use weblate to allow users with no technical background to help to translate the frontend. Weblate seems to have the default to use "_" instead of "-" for languages. There is probably a setting for that somewhere, which would be the ideal fix.
  • Yeah, I think that that's fine. I think we only use it in the sidebar for the timestamp.
  • It looks to me like they are trying to add this in a future release. I think it's fine for now to add humanize-duration, but we should keep an issue open to remove it, once Luxon has that functionality.

Looking forward to your pull request 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants