This is an automated email from the ASF dual-hosted git repository.
zky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new e524ea74d fix: the start and end times are reversed (#8084)
e524ea74d is described below
commit e524ea74db2292349e5f19d637830c0c253f6c9b
Author: 青湛 <[email protected]>
AuthorDate: Fri Sep 20 22:12:11 2024 +1200
fix: the start and end times are reversed (#8084)
---
config-ui/src/routes/pipeline/components/duration.tsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/config-ui/src/routes/pipeline/components/duration.tsx
b/config-ui/src/routes/pipeline/components/duration.tsx
index 3620fa4bd..136b70e5c 100644
--- a/config-ui/src/routes/pipeline/components/duration.tsx
+++ b/config-ui/src/routes/pipeline/components/duration.tsx
@@ -26,20 +26,20 @@ const duration = (minute: number) => {
}
if (minute < 60) {
- return `${Math.ceil(minute / 60)}m`;
+ return `${minute}m`;
}
if (minute < 60 * 24) {
const hours = Math.floor(minute / 60);
const minutes = minute - hours * 60;
- return `${hours}h${minutes}m`;
+ return `${hours}h${minutes !== 0 ? `${minutes}m` : ''}`;
}
const days = Math.floor(minute / (60 * 24));
const hours = Math.floor((minute - days * 60 * 24) / 60);
const minutes = minute - days * 60 * 24 - hours * 60;
- return `${days}d${hours}h${minutes}m`;
+ return `${days}d${hours !== 0 ? `${hours}h` : ''}${minutes !== 0 ?
`${minutes}m` : ''}`;
};
interface Props {
@@ -58,12 +58,12 @@ export const PipelineDuration = ({ status, beganAt,
finishedAt }: Props) => {
status,
)
) {
- return <span>{duration(dayjs(beganAt).diff(dayjs(), 'm'))}</span>;
+ return <span>{duration(dayjs().diff(dayjs(beganAt), 'm'))}</span>;
}
if (!finishedAt) {
return <span>-</span>;
}
- return <span>{duration(dayjs(beganAt).diff(dayjs(finishedAt), 'm'))}</span>;
+ return <span>{duration(dayjs(finishedAt).diff(dayjs(beganAt), 'm'))}</span>;
};