Replace moment with luxon

Signed-off-by: Julio Zynger <julio.zynger@soundcloud.com>
This commit is contained in:
Julio Zynger
2022-03-01 14:13:57 +01:00
committed by Fredrik Adelöw
parent 5ed59fb8c1
commit a9c4cc9167
2 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -30,7 +30,7 @@
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.57",
"moment": "^2.29.1",
"luxon": "^2.0.2",
"react-use": "^17.2.4"
},
"peerDependencies": {
@@ -46,6 +46,7 @@
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^13.1.8",
"@types/jest": "^26.0.7",
"@types/luxon": "^2.0.4",
"@types/node": "^14.14.32",
"cross-fetch": "^3.1.5",
"msw": "^0.35.0"
@@ -15,7 +15,7 @@
*/
import React from 'react';
import moment from 'moment';
import { DateTime } from 'luxon';
import { Entity } from '@backstage/catalog-model';
import { useApi } from '@backstage/core-plugin-api';
import { useEntity } from '@backstage/plugin-catalog-react';
@@ -69,7 +69,9 @@ const renderSeverity = (severity: string): React.ReactNode => {
};
const renderLastOccurrence = (error: AggregatedError): React.ReactNode => {
return moment(new Date(error.latest_errors[0].timestamp * 1000)).fromNow();
return DateTime.fromMillis(
error.latest_errors[0].timestamp * 1000,
).toRelative();
};
function isNotFoundInInstance(