-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support "last weekday of the month" expressions (#245)
* Implement "L" in weekday * Improve implementation and add more tests * Remove updted lockfile from PR * Apply suggestions from code review Co-authored-by: Harri Siirak <harri@siirak.ee> * Rename method * Rename crondate * Style fixes * Ensure cron expression strigifies correctly * Document weekday expressions * Add test case for multiple L weekdays sequences * Style fix Co-authored-by: Harri Siirak <harri@siirak.ee> Co-authored-by: Harri Siirak <harri@siirak.ee>
- Loading branch information
1 parent
45b4a6c
commit d18ad74
Showing
7 changed files
with
243 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// empty around comma | ||
|
||
var test = require('tap').test; | ||
var CronDate = require('../lib/date'); | ||
|
||
test('is the last weekday of the month', function (t) { | ||
// Last monday of septhember | ||
var date = new CronDate(new Date(2021, 8, 27)); | ||
t.equal(date.isLastWeekdayOfMonth(), true); | ||
|
||
// Second-to-last monday of septhember | ||
var date = new CronDate(new Date(2021, 8, 20)); | ||
t.equal(date.isLastWeekdayOfMonth(), false); | ||
|
||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.