README.md in parse-cron-ext-0.1.2 vs README.md in parse-cron-ext-0.2.0
- old
+ new
@@ -1,6 +1,8 @@
# parse-cron-ext
+[![Gem Version](https://badge.fury.io/rb/parse-cron-ext.svg)](https://badge.fury.io/rb/parse-cron-ext)
+[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
parse-cron-ext is a extension (monkey-patch) for parse-cron 0.1.4, which is the latest version.
siebertm/parse-cron: https://github.com/siebertm/parse-cron
Warning:
@@ -21,12 +23,13 @@
$ gem install parse-cron-ext
## Usage
These notations are inspired by [AWS Cron Expressions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html).
-
-
+
+
+You can express...
### End of the month by using L notation
```ruby
cron_parser = CronParser.new('0 9 L * *')
time = Time.local(2022, 1, 16, 12, 0)
@@ -59,11 +62,23 @@
# second sunday in march
cron_parser = CronParser.new('0 9 * 3 SUN#2')
time = Time.local(2022, 1, 3, 12, 0)
cron_parser.next(time)
- # => 2022-03-31 09:00
+ # => 2022-03-13 09:00
```
+
+
+### Weekday by using W notation
+ ```ruby
+ # next weekday
+ cron_parser = CronParser.new('0 0 * * W')
+
+ time = Time.local(2022, 2, 11, 12, 0)
+ cron_parser.next(time)
+ # => 2022-02-14 00:00
+ ```
+https://www.timeanddate.com/calendar/
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.