From e7807c4c79522491ef3705aa26845aad3dc20444 Mon Sep 17 00:00:00 2001 From: Samira Mokaram Date: Tue, 1 Dec 2020 18:23:39 +0100 Subject: [PATCH] remove moment --- plugins/pagerduty/package.json | 12 ++++++------ .../src/components/Incident/IncidentListItem.tsx | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/pagerduty/package.json b/plugins/pagerduty/package.json index 2fce2ebef3..64cc5a0893 100644 --- a/plugins/pagerduty/package.json +++ b/plugins/pagerduty/package.json @@ -20,21 +20,21 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.3.0", - "@backstage/theme": "^0.2.1", "@backstage/catalog-model": "^0.2.0", - "@backstage/test-utils": "^0.1.2", + "@backstage/core": "^0.3.0", "@backstage/plugin-catalog": "^0.2.1", + "@backstage/test-utils": "^0.1.2", + "@backstage/theme": "^0.2.1", "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", + "date-fns": "^2.16.1", "react": "^16.13.1", "react-dom": "^16.13.1", - "react-use": "^15.3.3", - "moment": "^2.27.0" + "react-use": "^15.3.3" }, "devDependencies": { - "@backstage/cli": "^0.2.0", + "@backstage/cli": "^0.3.1", "@backstage/dev-utils": "^0.1.3", "@testing-library/jest-dom": "^5.10.1", "@testing-library/react": "^10.4.1", diff --git a/plugins/pagerduty/src/components/Incident/IncidentListItem.tsx b/plugins/pagerduty/src/components/Incident/IncidentListItem.tsx index 488631b834..7a34501325 100644 --- a/plugins/pagerduty/src/components/Incident/IncidentListItem.tsx +++ b/plugins/pagerduty/src/components/Incident/IncidentListItem.tsx @@ -27,7 +27,7 @@ import { Typography, } from '@material-ui/core'; import { StatusError, StatusWarning } from '@backstage/core'; -import moment from 'moment'; +import { formatDistanceToNowStrict } from 'date-fns'; import { Incident } from '../types'; import { PagerDutyIcon } from '../PagerDutyIcon'; @@ -54,7 +54,7 @@ type Props = { export const IncidentListItem = ({ incident }: Props) => { const classes = useStyles(); const user = incident.assignments[0]?.assignee; - const createdAt = moment(incident.created_at).fromNow(); + const createdAt = formatDistanceToNowStrict(new Date(incident.created_at)); return ( @@ -77,7 +77,7 @@ export const IncidentListItem = ({ incident }: Props) => { }} secondary={ - Created {createdAt} and assigned to{' '} + Created {createdAt} ago and assigned to{' '}