Merge pull request #6022 from vcapretz/chore/circleci-remove-moment
Chore/circleci remove moment
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-circleci': patch
|
||||
---
|
||||
|
||||
Remove moment as part 1 of migration to `lexon`
|
||||
@@ -41,7 +41,6 @@
|
||||
"circleci-api": "^4.0.0",
|
||||
"dayjs": "^1.9.4",
|
||||
"lodash": "^4.17.15",
|
||||
"moment": "^2.25.3",
|
||||
"react": "^16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-lazylog": "^4.5.2",
|
||||
|
||||
+3
-7
@@ -24,11 +24,10 @@ import {
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||
import { BuildStepAction } from 'circleci-api';
|
||||
import moment from 'moment';
|
||||
import React, { Suspense, useEffect, useState } from 'react';
|
||||
import { durationHumanized } from '../../../../util';
|
||||
|
||||
const LazyLog = React.lazy(() => import('react-lazylog/build/LazyLog'));
|
||||
moment.relativeTimeThreshold('ss', 0);
|
||||
const useStyles = makeStyles({
|
||||
accordionDetails: {
|
||||
padding: 0,
|
||||
@@ -66,11 +65,8 @@ export const ActionOutput = ({
|
||||
});
|
||||
}, [url]);
|
||||
|
||||
const timeElapsed = moment
|
||||
.duration(
|
||||
moment(action.end_time || moment()).diff(moment(action.start_time)),
|
||||
)
|
||||
.humanize();
|
||||
const timeElapsed = durationHumanized(action.start_time, action.end_time);
|
||||
|
||||
return (
|
||||
<Accordion TransitionProps={{ unmountOnExit: true }} className={className}>
|
||||
<AccordionSummary
|
||||
|
||||
@@ -31,5 +31,7 @@ export function durationHumanized(
|
||||
startTime: DateTimeObject,
|
||||
endTime: DateTimeObject,
|
||||
) {
|
||||
return dayjs.duration(dayjs(startTime).diff(dayjs(endTime))).humanize();
|
||||
return dayjs
|
||||
.duration(dayjs(startTime).diff(dayjs(endTime || new Date())))
|
||||
.humanize();
|
||||
}
|
||||
|
||||
@@ -18766,7 +18766,7 @@ modify-values@^1.0.0:
|
||||
resolved "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
|
||||
integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==
|
||||
|
||||
moment@^2.19.3, moment@^2.25.3, moment@^2.27.0, moment@^2.29.1:
|
||||
moment@^2.19.3, moment@^2.27.0, moment@^2.29.1:
|
||||
version "2.29.1"
|
||||
resolved "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3"
|
||||
integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==
|
||||
|
||||
Reference in New Issue
Block a user