diff --git a/.changeset/curvy-islands-marry.md b/.changeset/curvy-islands-marry.md new file mode 100644 index 0000000000..2d3bad31ac --- /dev/null +++ b/.changeset/curvy-islands-marry.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-github-pull-requests-board': patch +--- + +Replace the momentjs dependency with luxon. diff --git a/plugins/github-pull-requests-board/package.json b/plugins/github-pull-requests-board/package.json index cc15d368ee..e2956099ac 100644 --- a/plugins/github-pull-requests-board/package.json +++ b/plugins/github-pull-requests-board/package.json @@ -44,7 +44,7 @@ "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.57", "@octokit/rest": "^19.0.3", - "moment": "^2.29.1", + "luxon": "^3.0.0", "react-use": "^17.2.4" }, "devDependencies": { diff --git a/plugins/github-pull-requests-board/src/utils/functions.ts b/plugins/github-pull-requests-board/src/utils/functions.ts index 69b3ecf794..5644530689 100644 --- a/plugins/github-pull-requests-board/src/utils/functions.ts +++ b/plugins/github-pull-requests-board/src/utils/functions.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import { Entity } from '@backstage/catalog-model'; -import moment from 'moment'; +import { DateTime } from 'luxon'; import { Reviews, PullRequests, @@ -58,7 +58,7 @@ export const filterSameUser = (users: Author[]): Author[] => { }; export const getElapsedTime = (start: string): string => { - return moment(start).fromNow(); + return DateTime.fromISO(start).toRelative() ?? start; }; export const formatPRsByReviewDecision = ( diff --git a/yarn.lock b/yarn.lock index 05d79d90b3..83ca72c771 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5674,7 +5674,7 @@ __metadata: "@types/node": ^16.11.26 "@types/react": ^16.13.1 || ^17.0.0 cross-fetch: ^3.1.5 - moment: ^2.29.1 + luxon: ^3.0.0 msw: ^0.47.0 react-use: ^17.2.4 peerDependencies: