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

Handling of Deprecated Library "Moment.js" #167

Open
ghost opened this issue Sep 16, 2022 · 1 comment
Open

Handling of Deprecated Library "Moment.js" #167

ghost opened this issue Sep 16, 2022 · 1 comment
Labels
⚰️ deprecation 🕸 the library or the way it is written is becoming obsolete or deprecated ⭐ P3 Third priority

Comments

@ghost
Copy link

ghost commented Sep 16, 2022

Handling of Deprecated Library "Moment.js"

Issue:

The library called "Moment.js" has been deprecated since 2020, but it's present in many parts of this repository.

Solution:

A developer must find every page where "Moment.js" is being used, and replace it with a new library that handles dates and times.

Solution Steps:

  1. Pick an alternative library, some options are "luxon", "date-fns" and "day.js". An article where these options are explained is: https://8thlight.com/blog/justyna-jurkowska/2021/06/16/life-after-moment.html

Pages for the alternative libraries: day.js, luxon, and date-fns These libraries do not have a deprecation date yet but keep an eye on that as you start replacing the use of moment.js in the code.

  1. Find which places are using "moment.js" inside the repository, and replace them with your new library of choice.
  2. Run all the tests provided in the repo to make sure that your integration was successful.
  3. Create a pull request so that your code can be evaluated by the Lead Developer before deployment.
  4. Keep an eye out for any new bugs that arise after the change is deployed to the code.
@ingindIsrael ingindIsrael added ⭐ P2 Second priority ⚰️ deprecation 🕸 the library or the way it is written is becoming obsolete or deprecated labels Sep 16, 2022
@ghost
Copy link
Author

ghost commented Sep 16, 2022

Visual Resources:

The image below is a screenshot from the "Dashboard" view, specifically when you click "Create Shift" and the right-side menu bar pops up.

The menu bar asks you questions about the shift you want to create, and one of them is the date of the shift. This part has a label called "Dates" as seen in the image.

By clicking on the input form under the label, a calendar appears. Once you click a date in the calendar, the function "getRealDate()" is triggered, and it uses "moment.js" to obtain the current date.

Note: The function "getRealDate()" exists in line: 2317, path: /workspace/employer-web-client/src/js/views/shifts.js

DatePicker screenshot

How it's being imported:

import moment from "moment";

Code block example:

Note: This block extends from line: "2173" to line: "2194" from path: "/workspace/employer-web-client/src/js/views/shifts.js"

screenshot

Final note

There are other places where "moment.js" is used, so we recommend searching "moment" throughout the whole repository and identifying every place where it is being used.

@ingindIsrael ingindIsrael added ⭐ P3 Third priority and removed ⭐ P2 Second priority labels Sep 16, 2022
@ghost ghost changed the title Handling of Deprecated Library "Moment.js" Bug: Handling of Deprecated Library "Moment.js" Sep 26, 2022
@ghost ghost changed the title Bug: Handling of Deprecated Library "Moment.js" Handling of Deprecated Library "Moment.js" Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚰️ deprecation 🕸 the library or the way it is written is becoming obsolete or deprecated ⭐ P3 Third priority
Projects
None yet
Development

No branches or pull requests

1 participant