Skip to content

Commit

Permalink
fix: Handle nullish timestamp / processedOn fields, closes #203
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Feb 25, 2021
1 parent 9d743df commit 301d332
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ui/components/JobCard/Timeline/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export const Timeline = function Timeline({
<ul className={s.timeline}>
<li>
<small>Added at</small>
<time>{formatDate(job.timestamp as number)}</time>
<time>{formatDate(job.timestamp || 0)}</time>
</li>
{!!job.delay && job.delay > 0 && status === 'delayed' && (
<li>
<small>Delayed for</small>
<time>
{formatDistance(
job.timestamp as number,
(job.timestamp as number) + job.delay,
job.timestamp || 0,
(job.timestamp || 0) + job.delay,
{ includeSeconds: true },
)}
</time>
Expand All @@ -46,7 +46,7 @@ export const Timeline = function Timeline({
<li>
<small>
{job.delay && job.delay > 0 ? 'delayed for ' : ''}
{formatDistance(job.processedOn, job.timestamp as number, {
{formatDistance(job.processedOn, job.timestamp || 0, {
includeSeconds: true,
})}
</small>
Expand All @@ -57,7 +57,7 @@ export const Timeline = function Timeline({
{!!job.finishedOn && (
<li>
<small>
{formatDistance(job.finishedOn, job.processedOn as number, {
{formatDistance(job.finishedOn, job.processedOn || 0, {
includeSeconds: true,
})}
</small>
Expand Down

0 comments on commit 301d332

Please sign in to comment.