update job mock to always use current date
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
[
|
||||
{ "title": "Monitor Real-Time Stock Market Data", "runningTime": "2m 34s", "progress": 65, "startTime": "2026-06-30T20:48:00Z", "eta": "2026-06-30T20:52:00Z" },
|
||||
{ "title": "Image Generation", "runningTime": "5m 12s", "progress": 30, "startTime": "2026-06-30T20:36:00Z", "eta": "2026-06-30T21:00:00Z" },
|
||||
{ "title": "Process & Categorize Inbox Emails", "runningTime": "12m 47s", "progress": 88, "startTime": "2026-06-30T20:25:00Z", "eta": "2026-06-30T20:40:00Z" }
|
||||
]
|
||||
@@ -0,0 +1,22 @@
|
||||
const now = new Date()
|
||||
|
||||
export default [
|
||||
{
|
||||
title: 'Monitor Real-Time Stock Market Data',
|
||||
progress: 65,
|
||||
startTime: new Date(now.getTime() - 100000).toISOString(),
|
||||
eta: new Date(now.getTime() + 100000).toISOString(),
|
||||
},
|
||||
{
|
||||
title: 'Image Generation',
|
||||
progress: 30,
|
||||
startTime: new Date(now.getTime() - 55000).toISOString(),
|
||||
eta: new Date(now.getTime() + 300000).toISOString(),
|
||||
},
|
||||
{
|
||||
title: 'Process & Categorize Inbox Emails',
|
||||
progress: 88,
|
||||
startTime: new Date(now.getTime() - 30000).toISOString(),
|
||||
eta: new Date(now.getTime() + 30000).toISOString(),
|
||||
},
|
||||
]
|
||||
+18
-2
@@ -1,7 +1,23 @@
|
||||
export function formatTime(iso: string, options?: Intl.DateTimeFormatOptions): string {
|
||||
return new Date(iso).toLocaleTimeString([], {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
...options,
|
||||
})
|
||||
}
|
||||
|
||||
export function formatElapsed(startTime: string): string {
|
||||
const elapsed = Math.max(0, Math.floor((Date.now() - new Date(startTime).getTime()) / 1000))
|
||||
const days = Math.floor(elapsed / 86400)
|
||||
const hours = Math.floor((elapsed % 86400) / 3600)
|
||||
const minutes = Math.floor((elapsed % 3600) / 60)
|
||||
const seconds = elapsed % 60
|
||||
|
||||
const parts: string[] = []
|
||||
if (days > 0) parts.push(`${days}d`)
|
||||
if (hours > 0) parts.push(`${hours}h`)
|
||||
if (minutes > 0) parts.push(`${minutes}m`)
|
||||
parts.push(`${seconds}s`)
|
||||
|
||||
return parts.join(' ')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user