mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
992 B
992 B
Match Cron
Instructions
Create a function called matchCron
it takes a valid cron schedule string
and a valid date.
It returns true if the date match the pattern
You only have to implement numbers and
*
.
other complex patterns are not required.
Only valid pattern will be tested.
Example
matchCron('9 * * * *', new Date('2020-05-30 18:09:00')) // -> true
matchCron('9 * * * *', new Date('2020-05-30 19:09:00')) // -> true
matchCron('9 * * * *', new Date('2020-05-30 19:21:00')) // -> false
// | | | | |
// | | | | +- Day of the Week (range: 1-7, 1 standing for Monday)
// | | | +--- Month of the Year (range: 1-12)
// | | +----- Day of the Month (range: 1-31)
// | +------- Hour (range: 0-23)
// +--------- Minute (range: 0-59)