This commit is contained in:
2025-09-02 20:46:10 +08:00
parent d73659fed3
commit c579e53ad1
2 changed files with 17 additions and 20 deletions

View File

@@ -26,12 +26,9 @@ func (cmd *SchedulePublishCommand) GetScheduledTime() (time.Time, error) {
}
for _, format := range formats {
if t, err := time.Parse(format, cmd.ScheduledTime); err == nil {
// 如果解析的时间没有时区信息,则设置为中国东八
if t.Location() == time.UTC {
t = t.In(cst)
}
return t, nil
if t, err := time.ParseInLocation(format, cmd.ScheduledTime, cst); err == nil {
// 确保返回的时间是东八区时
return t.In(cst), nil
}
}