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

refactor(deps): remove moment dep and usage #12611

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

agilgur5
Copy link
Member

@agilgur5 agilgur5 commented Feb 3, 2024

Related to the goals of #12059, just removing / replacing a large dep entirely.
Follow-up to #12097

Motivation

moment has been deprecated since Sep 2020 and recommends using native Intl or newer libraries that make use of native Intl, such as luxon and day.js

  • moment is also a very large dependency and hence is ripe for pruning and replacement as well

  • shave off X kb by replacing ~15 LoC

Modifications

  • replace all usage of moment with regular Date functions
    • valueOf() works the same way for Date and moment
    • diff doesn't exist, but it's a one-liner helper
    • format doesn't exist, but we can also use a simple helper for that

Verification

TODO: insert screenshots of UI and webpack-bundle-analyzer

NOTE: This is still a draft right now as to fully remove moment requires upstream changes in argo-ui: argoproj/argo-ui#535

`moment` has been [deprecated since Sep 2020](https://momentjs.com/docs/#/-project-status/) and recommends using native `Intl` or newer libraries that make use of native `Intl`, such as `luxon` and `dayjs`
  - `moment` is also a very large dependency and hence is ripe for pruning and replacement as well

- replace all usage of `moment` with regular `Date` functions
  - `valueOf()` works the same way for `Date` and `moment`
  - `diff` doesn't exist, but it's a one-liner helper
  - `format` doesn't exist, but we can also use a simple helper for that

- shave off X kb by replacing ~15 LoC

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
@agilgur5 agilgur5 added type/dependencies PRs and issues specific to updating dependencies area/ui javascript Pull requests that update Javascript dependencies labels Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui javascript Pull requests that update Javascript dependencies type/dependencies PRs and issues specific to updating dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant