Skip to content

Commit 9eb9cb1

Browse files
committed
计划时间改为东八区
1 parent ea61163 commit 9eb9cb1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

static/index.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,17 @@ <h2>任务列表</h2>
425425
setDefaultTime();
426426
});
427427

428-
// 设置默认时间为当前时间+1小时
428+
// 将 Date 转为 datetime-local 可用的本地时间字符串
429+
function toLocalInputValue(date) {
430+
const local = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
431+
return local.toISOString().slice(0, 16);
432+
}
433+
434+
// 设置默认时间为当前时间+1小时(东八区本地时间)
429435
function setDefaultTime() {
430436
const now = new Date();
431437
now.setHours(now.getHours() + 1);
432-
const timeString = now.toISOString().slice(0, 16);
433-
document.getElementById('scheduledTime').value = timeString;
438+
document.getElementById('scheduledTime').value = toLocalInputValue(now);
434439
}
435440

436441
// 加载通知渠道
@@ -592,11 +597,12 @@ <h2>任务列表</h2>
592597
});
593598

594599
// 构建任务数据
600+
const scheduledTimeValue = formData.get('scheduledTime');
595601
const taskData = {
596602
title: formData.get('title'),
597603
content: formData.get('content'),
598604
channel: channel,
599-
scheduled_time: new Date(formData.get('scheduledTime')).toISOString(),
605+
scheduled_time: scheduledTimeValue ? `${scheduledTimeValue}:00` : null,
600606
channel_config: channelConfig,
601607
is_recurring: formData.get('isRecurring') === 'on',
602608
cron_expression: formData.get('isRecurring') === 'on' ? formData.get('cronExpression') : null

0 commit comments

Comments
 (0)