Skip to content

Commit

Permalink
show relative time in runs list
Browse files Browse the repository at this point in the history
  • Loading branch information
lucafaggianelli committed Jun 9, 2023
1 parent a6d04c1 commit 59d0586
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions frontend/src/components/RunsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Text,
Title,
} from '@tremor/react'
import { formatDistanceToNow, differenceInDays } from 'date-fns'
import { useCallback, useEffect, useState } from 'react'
import { Link, useNavigate } from 'react-router-dom'
import useWebSocket from 'react-use-websocket'
Expand Down Expand Up @@ -146,8 +147,15 @@ const RunsList: React.FC<Props> = ({ pipelineId, runs: _runs, triggerId }) => {
</Link>
</TableCell>
)}
<TableCell>
<Text>{formatDateTime(run.start_time)}</Text>
<TableCell title={formatDateTime(run.start_time)}>
<Text>
{differenceInDays(new Date(), run.start_time) <= 1
? formatDistanceToNow(run.start_time, {
addSuffix: true,
includeSeconds: true,
})
: formatDateTime(run.start_time)}
</Text>
</TableCell>
<TableCell className="text-right">
{run.status !== 'running' ? (
Expand Down

0 comments on commit 59d0586

Please sign in to comment.