Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing begin time flag #268

Merged
merged 6 commits into from
Mar 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/core/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func Timer(opts TimerOptions) (<-chan Update, error) {
return nil, fmt.Errorf("invalid format for begin delay '%s': %v", opts.Begin, err)
}
delay = time.Duration(delayMins) * time.Minute
case len(startTimeParts) > 3:
case len(startTimeParts) > 2:
hour, err := strconv.Atoi(startTimeParts[1])
if err != nil {
return nil, fmt.Errorf("invalid format for begin delay '%s': %v", opts.Begin, err)
Expand All @@ -93,7 +93,7 @@ func Timer(opts TimerOptions) (<-chan Update, error) {
// convert that start time into a Duration to wait
now := time.Now()

today := time.Date(now.Year(), now.Month(), now.Day(), hour, minute, now.Second(), now.Nanosecond(), time.UTC)
today := time.Date(now.Year(), now.Month(), now.Day(), hour, minute, now.Second(), now.Nanosecond(), time.Local)
if today.After(now) {
delay = today.Sub(now)
} else {
Expand Down