Skip to content

Commit 5c75f54

Browse files
committed
Shift date management from momentjs to dayjs
1 parent de916be commit 5c75f54

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

client/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
"@react-hook/resize-observer": "^1.2.6",
3434
"bootstrap": "^5.2.3",
3535
"core-js": "^3.8.0",
36+
"dayjs": "^1.11.7",
3637
"graphql": "^16.6.0",
3738
"lodash": "^4.17.21",
38-
"moment": "^2.25.3",
3939
"node-fetch": "^2.6.1",
4040
"object-hash": "^3.0.0",
4141
"octicons-react": "^1.0.4",
@@ -112,7 +112,9 @@
112112
"setupFilesAfterEnv": [
113113
"./jest.setup.js"
114114
],
115-
"transformIgnorePatterns": ["<rootDir>/node_modules/(?!(@juggle/resize-observer|@react-hook/resize-observer)/)"],
115+
"transformIgnorePatterns": [
116+
"<rootDir>/node_modules/(?!(@juggle/resize-observer|@react-hook/resize-observer)/)"
117+
],
116118
"transform": {
117119
"^.+\\.(js|jsx|mjs)$": "babel-jest"
118120
},

client/utils/formatter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import moment from 'moment';
1+
import dayjs from 'dayjs';
22

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

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

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

3434
export const convertStringFormatToAnotherFormat = (
3535
date,
3636
fromFormat = 'DD-MM-YYYY',
3737
toFormat = 'MM-DD-YYYY'
3838
) => {
39-
return moment(date, fromFormat).format(toFormat);
39+
return dayjs(date, fromFormat).format(toFormat);
4040
};
4141

4242
export const isValidDate = (date, format = 'DD-MM-YYYY') => {
43-
return moment(date, format).isValid();
43+
return dayjs(date, format).isValid();
4444
};

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"connect-pg-simple": "^8.0.0",
3636
"cross-fetch": "^3.1.5",
3737
"cross-spawn": "^7.0.3",
38+
"dayjs": "^1.11.7",
3839
"dotenv": "^16.0.3",
3940
"dotenv-cli": "^6.0.0",
4041
"express": "^5.0.0-alpha.8",
@@ -45,7 +46,6 @@
4546
"js-base64": "^3.6.1",
4647
"lodash": "^4.17.21",
4748
"minimist": "^1.2.7",
48-
"moment": "^2.29.4",
4949
"node-cache": "^5.1.2",
5050
"nodegit": "^0.28.0-alpha.20",
5151
"nodemon": "^2.0.7",

server/resolvers/TestPlanReport/issuesResolver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const { GithubService } = require('../../services');
22
const { Base64 } = require('js-base64');
3-
const moment = require('moment');
3+
const dayjs = require('dayjs');
44

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

88
const searchPrefix = `${testPlanReport.at.name} Feedback: "`;
99
const searchTestPlanVersionTitle =
1010
testPlanReport.testPlanVersion.dataValues.title;
11-
const searchTestPlanVersionDate = moment(
11+
const searchTestPlanVersionDate = dayjs(
1212
testPlanReport.testPlanVersion.updatedAt
1313
).format('DD-MM-YYYY');
1414
const cacheId = Base64.encode(

yarn.lock

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6488,6 +6488,11 @@ data-urls@^3.0.2:
64886488
whatwg-mimetype "^3.0.0"
64896489
whatwg-url "^11.0.0"
64906490

6491+
dayjs@^1.11.7:
6492+
version "1.11.7"
6493+
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2"
6494+
integrity sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==
6495+
64916496
[email protected], debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
64926497
version "2.6.9"
64936498
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@@ -11786,7 +11791,7 @@ moment-timezone@^0.5.21:
1178611791
dependencies:
1178711792
moment ">= 2.9.0"
1178811793

11789-
"moment@>= 2.9.0", moment@^2.24.0, moment@^2.25.3, moment@^2.29.4:
11794+
"moment@>= 2.9.0", moment@^2.24.0:
1179011795
version "2.29.4"
1179111796
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
1179211797
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==

0 commit comments

Comments
 (0)