Skip to content

Commit

Permalink
Merge pull request #81 from winebarrel/fix_cronskd
Browse files Browse the repository at this point in the history
Fix cronskd: parse "-e" value
  • Loading branch information
winebarrel authored Nov 11, 2024
2 parents 2e5b081 + 5894898 commit 46a0d9f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ $ cronmatch '0 10 * * ? *' 'Oct 10, 2022, 10:10'
'0 10 * * ? *' does not match 'Oct 10, 2022, 10:10'
```

cf. https://github.com/araddon/dateparse
cf. https://pkg.go.dev/github.com/araddon/dateparse#readme-extended-example

# cronviz CLI

Expand Down Expand Up @@ -284,8 +284,20 @@ Mon, 11 Nov 2024 10:00:00 0 10 * * ? *
Mon, 11 Nov 2024 10:05:00 5 8-10 ? * MON-FRI *
Mon, 11 Nov 2024 12:15:00 15 12 * * ? *
Mon, 11 Nov 2024 18:00:00 0 18 ? * MON-FRI *
$ cronskd -s '2024/11/12 10:00' -e 'Nov 13, 2024, 12:00' ~/hoge
Tue, 12 Nov 2024 10:00:00 0 10 * * ? *
Tue, 12 Nov 2024 10:05:00 5 8-10 ? * MON-FRI *
Tue, 12 Nov 2024 12:15:00 15 12 * * ? *
Tue, 12 Nov 2024 18:00:00 0 18 ? * MON-FRI *
Wed, 13 Nov 2024 08:05:00 5 8-10 ? * MON-FRI *
Wed, 13 Nov 2024 09:05:00 5 8-10 ? * MON-FRI *
Wed, 13 Nov 2024 10:00:00 0 10 * * ? *
Wed, 13 Nov 2024 10:05:00 5 8-10 ? * MON-FRI *
```

cf. https://pkg.go.dev/github.com/araddon/dateparse#readme-extended-example

## Related Links

* [Cron expressions reference - Amazon EventBridge](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-cron-expressions.html)
Expand Down
6 changes: 6 additions & 0 deletions cmd/cronskd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ func main() {

if flags.end == "" {
end = time.Date(start.Year(), start.Month(), start.Day(), 23, 59, 50, 0, start.Location())
} else {
end, err = dateparse.ParseAny(flags.end)

if err != nil {
log.Fatal(err)
}
}

nexts := cron.Between(start, end)
Expand Down

0 comments on commit 46a0d9f

Please sign in to comment.