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
@@ -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(