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

Migrate date management from momentjs to dayjs #483

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d83957b
Update some major dependencies, webpack config and proxy management f…
howard-e Jan 5, 2023
7afe41b
Update icon packs
howard-e Jan 5, 2023
512ada5
webpack config changes
howard-e Jan 6, 2023
420c822
Update bootstrap
howard-e Jan 8, 2023
6ab5746
Update eslint & jest
howard-e Jan 9, 2023
d5c71f3
More dependency updates
howard-e Jan 9, 2023
c9ff257
Update connect-pg-simple
howard-e Jan 9, 2023
2e72491
Update dependencies and css
howard-e Jan 9, 2023
8f87f12
Update css
howard-e Jan 9, 2023
e6f15f3
Remove query-string dependency
howard-e Jan 9, 2023
c786f57
Update React
howard-e Jan 10, 2023
787a473
jest.setup.js update
howard-e Jan 10, 2023
9a916e6
Fix attempt for @react-hook/resize-observer library import
howard-e Jan 10, 2023
944130e
Revert "Update React"
howard-e Jan 24, 2023
fce646d
Update runtest.yml to use Node v18
howard-e Jan 24, 2023
8aed201
Updating form text (#485)
evmiguel Feb 8, 2023
7f2c2b2
Update dependencies test (#484)
evmiguel Feb 8, 2023
f922a69
Update React
howard-e Jan 10, 2023
56c2208
Revert "Update React"
howard-e Jan 24, 2023
e436a2d
Remove nodegit dependency
alflennik Feb 8, 2023
b7f2012
Address PR feedback
alflennik Feb 8, 2023
0ccd643
Fix files affected by revert on source branch
howard-e Feb 13, 2023
f9bac4a
Update React
howard-e Jan 10, 2023
944c873
Revert "Update React"
howard-e Jan 24, 2023
5e45a58
Fix fake data seeder
alflennik Feb 8, 2023
d7b9fff
Fix files affected by revert on source branch
howard-e Feb 13, 2023
e8d03fa
Merge pull request #487 from w3c/update-dependencies-fake-data
alflennik Feb 13, 2023
9717984
Merge pull request #486 from w3c/update-dependencies-nodegit
alflennik Feb 13, 2023
40d759f
Fix misspellings in the readme (#490)
alflennik Feb 13, 2023
d6b7dd1
Shift date management from momentjs to dayjs
howard-e Jan 11, 2023
b6b444e
Remove leftover artifacts from before React revert
howard-e Feb 13, 2023
7bdaae9
Update yarn.lock
howard-e Feb 15, 2023
663d8c2
Merge branch 'main' into move-to-dayjs
howard-e Mar 8, 2023
6dd2767
Update yarn.lock
howard-e Mar 8, 2023
3860102
Remove sass-loader dependency after incorrect merge
howard-e Mar 8, 2023
eebb667
Fix result of bad merge
howard-e Mar 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"@react-hook/resize-observer": "^1.2.6",
"bootstrap": "^5.2.3",
"core-js": "^3.8.0",
"dayjs": "^1.11.7",
"graphql": "^16.6.0",
"lodash": "^4.17.21",
"moment": "^2.25.3",
"node-fetch": "^2.6.1",
"object-hash": "^3.0.0",
"octicons-react": "^1.0.4",
Expand Down
10 changes: 5 additions & 5 deletions client/utils/formatter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import moment from 'moment';
import dayjs from 'dayjs';

/**
* Transforms the provided string by capitalizing the first letter of each word.
Expand All @@ -24,21 +24,21 @@ export const capitalizeEachWord = (

export const convertDateToString = (date, format = 'DD-MM-YYYY') => {
if (!date) return '';
return moment(date).format(format);
return dayjs(date).format(format);
};

export const convertStringToDate = (date, format = 'DD-MM-YYYY') => {
return moment(date, format).toDate();
return dayjs(date, format).toDate();
};

export const convertStringFormatToAnotherFormat = (
date,
fromFormat = 'DD-MM-YYYY',
toFormat = 'MM-DD-YYYY'
) => {
return moment(date, fromFormat).format(toFormat);
return dayjs(date, fromFormat).format(toFormat);
};

export const isValidDate = (date, format = 'DD-MM-YYYY') => {
return moment(date, format).isValid();
return dayjs(date, format).isValid();
};
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"connect-pg-simple": "^8.0.0",
"cross-fetch": "^3.1.5",
"cross-spawn": "^7.0.3",
"dayjs": "^1.11.7",
"dotenv": "^16.0.3",
"dotenv-cli": "^6.0.0",
"express": "^5.0.0-alpha.8",
Expand All @@ -46,7 +47,6 @@
"js-base64": "^3.6.1",
"lodash": "^4.17.21",
"minimist": "^1.2.7",
"moment": "^2.29.4",
"node-cache": "^5.1.2",
"nodemon": "^2.0.7",
"object-hash": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions server/resolvers/TestPlanReport/issuesResolver.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const { GithubService } = require('../../services');
const { Base64 } = require('js-base64');
const moment = require('moment');
const dayjs = require('dayjs');

const issuesResolver = async testPlanReport => {
if (!testPlanReport.candidateStatusReachedAt) return [];

const searchPrefix = `${testPlanReport.at.name} Feedback: "`;
const searchTestPlanVersionTitle =
testPlanReport.testPlanVersion.dataValues.title;
const searchTestPlanVersionDate = moment(
const searchTestPlanVersionDate = dayjs(
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking: Would it be better to use one of the util functions instead of dayjs directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Which util functions are you referring to there?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is the same as convertDateToString

testPlanReport.testPlanVersion.updatedAt
).format('DD-MM-YYYY');
const cacheId = Base64.encode(
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6757,6 +6757,11 @@ data-urls@^3.0.2:
whatwg-mimetype "^3.0.0"
whatwg-url "^11.0.0"

dayjs@^1.11.7:
version "1.11.7"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2"
integrity sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==

[email protected], debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
Expand Down Expand Up @@ -12025,7 +12030,7 @@ moment-timezone@^0.5.34:
dependencies:
moment ">= 2.9.0"

"moment@>= 2.9.0", moment@^2.25.3, moment@^2.29.1, moment@^2.29.4:
"moment@>= 2.9.0", moment@^2.29.1:
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
Expand Down