Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/svrnm/cronmatch
cronmatch checks if a date/time is matched by a cron expression
https://github.com/svrnm/cronmatch
Last synced: 11 days ago
JSON representation
cronmatch checks if a date/time is matched by a cron expression
- Host: GitHub
- URL: https://github.com/svrnm/cronmatch
- Owner: svrnm
- Created: 2018-07-27T12:01:50.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-05-08T07:38:33.000Z (over 1 year ago)
- Last Synced: 2024-04-29T10:06:53.837Z (6 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cronmatch
cronmatch checks if a date/time is matched by a cron expression.
# Usage
The `match` method accepts two parameters:
* a cron expression
* a date (or something that can be converted to a date)```javascript
const cronmatch = require('cronmatch')// If the minute of the current time is divisible by 5, do something
if (cronmatch.match('*/5 * * * *', Date.now())) {
...
}// Execute the following code only on a wednesday or on the 29 of February
if (cronmatch.match(['* * * * * 3 *','* * * 29 2 * *'], Date.now())) {
...
}
```