Skip to content

Commit e42f335

Browse files
committed
fixing time display
1 parent a7bff50 commit e42f335

6 files changed

Lines changed: 12 additions & 11 deletions

File tree

client/src/components/cron/CronExplanation.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Clock, AlertCircle, Loader } from 'lucide-react'
2+
import { formatLocalDate } from '../../utils/date.js'
23

34
export function CronExplanation({ validation }) {
45
const { valid, human, next_runs, error, isLoading } = validation
@@ -34,7 +35,7 @@ export function CronExplanation({ validation }) {
3435
<span className="text-[#909090] font-medium">Next: </span>
3536
{next_runs.map((t, i) => (
3637
<span key={t}>
37-
{new Date(t).toLocaleString()}
38+
{formatLocalDate(t)}
3839
{i < next_runs.length - 1 ? <span className="text-[#383838]"> &bull; </span> : ''}
3940
</span>
4041
))}

client/src/components/jobs/JobListItem.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { EnableToggle } from './EnableToggle.jsx'
44
import { Button } from '../ui/Button.jsx'
55
import { Tooltip } from '../ui/Tooltip.jsx'
66
import { MarkdownDescription } from '../ui/MarkdownDescription.jsx'
7+
import { formatLocalDate } from '../../utils/date.js'
78

89
function StatusBadge({ status }) {
910
if (!status) return <Badge variant="neutral">Never run</Badge>
@@ -50,7 +51,7 @@ export function JobListItem({ job, onEdit, onDelete, onToggle, onTrigger, onHist
5051
<StatusBadge status={job.last_run_status} />
5152
{job.last_run_at && (
5253
<span className="text-xs text-[#505050]">
53-
{new Date(job.last_run_at).toLocaleString()}
54+
{formatLocalDate(job.last_run_at)}
5455
</span>
5556
)}
5657
</div>

client/src/components/runs/RunRecord.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState } from 'react'
22
import { ChevronDown, ChevronUp, CheckCircle, XCircle, Clock, Terminal } from 'lucide-react'
33
import { Badge } from '../ui/Badge.jsx'
4+
import { formatLocalDate } from '../../utils/date.js'
45

56
function formatDuration(ms) {
67
if (!ms) return null
@@ -34,7 +35,7 @@ export function RunRecord({ run }) {
3435
</Badge>
3536
<div className="flex-1 min-w-0">
3637
<p className="text-xs text-[#909090]">
37-
{new Date(run.started_at).toLocaleString()}
38+
{formatLocalDate(run.started_at)}
3839
{run.duration_ms != null && (
3940
<span className="ml-2 text-[#505050]">{formatDuration(run.duration_ms)}</span>
4041
)}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cronpilot",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"author": "Christian Kellner",
55
"license": "Apache-2.0",
66
"scripts": {

server/src/scheduler/executor.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ export function run(job, triggeredBy = 'scheduler') {
1717
const runId = runResult.lastInsertRowid
1818
logger.info({ jobId: job.id, runId, triggeredBy }, `Job "${job.name}" started`)
1919

20-
if (job.ntfy_enabled && job.ntfy_on_run) {
21-
ntfySend(job, { status: 'running' }).catch(() => {})
22-
}
23-
2420
const child = job.command_type === 'inline'
2521
? spawn('/bin/sh', ['-c', job.command], { stdio: ['ignore', 'pipe', 'pipe'] })
2622
: spawn(job.command, [], { shell: true, stdio: ['ignore', 'pipe', 'pipe'] })
@@ -74,13 +70,13 @@ export function run(job, triggeredBy = 'scheduler') {
7470
)
7571
`).run(job.id, job.id, maxRuns)
7672

77-
logger.info({ jobId: job.id, runId, status, exitCode, duration }, `Job "${job.name}" finished`)
78-
7973
if (status === 'error' && job.ntfy_enabled && job.ntfy_on_error) {
8074
ntfySend(job, { status, exitCode, stderr }).catch(() => {})
8175
} else if (status === 'success' && job.ntfy_enabled && job.ntfy_on_run) {
8276
ntfySend(job, { status, exitCode }).catch(() => {})
8377
}
78+
79+
logger.info({ jobId: job.id, runId, status, exitCode, duration }, `Job "${job.name}" finished`)
8480
})
8581

8682
return runId

server/src/services/ntfy.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { logger } from '../logger.js'
12
export async function send(job, context) {
23
if (!job.ntfy_enabled || !job.ntfy_topic) return
34
try {
@@ -19,7 +20,8 @@ export async function send(job, context) {
1920
},
2021
body
2122
})
22-
} catch {
23+
} catch (error) {
24+
logger.error({error}, 'Failed to send notification to ntfy')
2325
// ntfy errors must never affect job execution
2426
}
2527
}

0 commit comments

Comments
 (0)