@@ -57,33 +57,33 @@ describe("Cron", () => {
5757 } )
5858
5959 it ( "match" , ( ) => {
60- assertTrue ( match ( "5 0 * 8 *" , "2024-08-01 00:05:00" ) )
61- assertFalse ( match ( "5 0 * 8 *" , "2024-09-01 00:05:00" ) )
62- assertFalse ( match ( "5 0 * 8 *" , "2024-08-01 01:05:00" ) )
60+ assertTrue ( match ( "5 0 * 8 *" , new Date ( "2024-08-01 00:05:00" ) ) )
61+ assertFalse ( match ( "5 0 * 8 *" , new Date ( "2024-09-01 00:05:00" ) ) )
62+ assertFalse ( match ( "5 0 * 8 *" , new Date ( "2024-08-01 01:05:00" ) ) )
6363
64- assertTrue ( match ( "15 14 1 * *" , "2024-02-01 14:15:00" ) )
65- assertFalse ( match ( "15 14 1 * *" , "2024-02-01 15:15:00" ) )
66- assertFalse ( match ( "15 14 1 * *" , "2024-02-02 14:15:00" ) )
64+ assertTrue ( match ( "15 14 1 * *" , new Date ( "2024-02-01 14:15:00" ) ) )
65+ assertFalse ( match ( "15 14 1 * *" , new Date ( "2024-02-01 15:15:00" ) ) )
66+ assertFalse ( match ( "15 14 1 * *" , new Date ( "2024-02-02 14:15:00" ) ) )
6767
68- assertTrue ( match ( "23 0-20/2 * * 0" , "2024-01-07 00:23:00" ) )
69- assertFalse ( match ( "23 0-20/2 * * 0" , "2024-01-07 03:23:00" ) )
70- assertFalse ( match ( "23 0-20/2 * * 0" , "2024-01-08 00:23:00" ) )
68+ assertTrue ( match ( "23 0-20/2 * * 0" , new Date ( "2024-01-07 00:23:00" ) ) )
69+ assertFalse ( match ( "23 0-20/2 * * 0" , new Date ( "2024-01-07 03:23:00" ) ) )
70+ assertFalse ( match ( "23 0-20/2 * * 0" , new Date ( "2024-01-08 00:23:00" ) ) )
7171
72- assertTrue ( match ( "5 4 * * SUN" , "2024-01-07 04:05:00" ) )
73- assertFalse ( match ( "5 4 * * SUN" , "2024-01-08 04:05:00" ) )
74- assertFalse ( match ( "5 4 * * SUN" , "2025-01-07 04:05:00" ) )
72+ assertTrue ( match ( "5 4 * * SUN" , new Date ( "2024-01-07 04:05:00" ) ) )
73+ assertFalse ( match ( "5 4 * * SUN" , new Date ( "2024-01-08 04:05:00" ) ) )
74+ assertFalse ( match ( "5 4 * * SUN" , new Date ( "2025-01-07 04:05:00" ) ) )
7575
76- assertTrue ( match ( "5 4 * DEC SUN" , "2024-12-01 04:05:00" ) )
77- assertFalse ( match ( "5 4 * DEC SUN" , "2024-12-01 04:06:00" ) )
78- assertFalse ( match ( "5 4 * DEC SUN" , "2024-12-02 04:05:00" ) )
76+ assertTrue ( match ( "5 4 * DEC SUN" , new Date ( "2024-12-01 04:05:00" ) ) )
77+ assertFalse ( match ( "5 4 * DEC SUN" , new Date ( "2024-12-01 04:06:00" ) ) )
78+ assertFalse ( match ( "5 4 * DEC SUN" , new Date ( "2024-12-02 04:05:00" ) ) )
7979
80- assertTrue ( match ( "5 4 * * SUN" , "2024-01-07 04:05:00" ) )
81- assertFalse ( match ( "5 4 * * SUN" , "2024-01-08 04:05:00" ) )
82- assertFalse ( match ( "5 4 * * SUN" , "2025-01-07 04:05:00" ) )
80+ assertTrue ( match ( "5 4 * * SUN" , new Date ( "2024-01-07 04:05:00" ) ) )
81+ assertFalse ( match ( "5 4 * * SUN" , new Date ( "2024-01-08 04:05:00" ) ) )
82+ assertFalse ( match ( "5 4 * * SUN" , new Date ( "2025-01-07 04:05:00" ) ) )
8383
84- assertTrue ( match ( "42 5 0 * 8 *" , "2024-08-01 00:05:42" ) )
85- assertFalse ( match ( "42 5 0 * 8 *" , "2024-09-01 00:05:42" ) )
86- assertFalse ( match ( "42 5 0 * 8 *" , "2024-08-01 01:05:42" ) )
84+ assertTrue ( match ( "42 5 0 * 8 *" , new Date ( "2024-08-01 00:05:42" ) ) )
85+ assertFalse ( match ( "42 5 0 * 8 *" , new Date ( "2024-09-01 00:05:42" ) ) )
86+ assertFalse ( match ( "42 5 0 * 8 *" , new Date ( "2024-08-01 01:05:42" ) ) )
8787
8888 const london = DateTime . zoneUnsafeMakeNamed ( "Europe/London" )
8989 const londonTime = DateTime . unsafeMakeZoned ( "2024-06-01 14:15:00Z" , {
@@ -146,11 +146,11 @@ describe("Cron", () => {
146146 } )
147147
148148 it ( "handles leap years" , ( ) => {
149- assertTrue ( match ( "0 0 29 2 *" , "2024-02-29 00:00:00" ) )
150- assertFalse ( match ( "0 0 29 2 *" , "2025-02-29 00:00:00" ) )
151- assertFalse ( match ( "0 0 29 2 *" , "2026-02-29 00:00:00" ) )
152- assertFalse ( match ( "0 0 29 2 *" , "2027-02-29 00:00:00" ) )
153- assertTrue ( match ( "0 0 29 2 *" , "2028-02-29 00:00:00" ) )
149+ assertTrue ( match ( "0 0 29 2 *" , new Date ( "2024-02-29 00:00:00" ) ) )
150+ assertFalse ( match ( "0 0 29 2 *" , new Date ( "2025-02-29 00:00:00" ) ) )
151+ assertFalse ( match ( "0 0 29 2 *" , new Date ( "2026-02-29 00:00:00" ) ) )
152+ assertFalse ( match ( "0 0 29 2 *" , new Date ( "2027-02-29 00:00:00" ) ) )
153+ assertTrue ( match ( "0 0 29 2 *" , new Date ( "2028-02-29 00:00:00" ) ) )
154154
155155 deepStrictEqual ( next ( "0 0 29 2 *" , new Date ( "2024-01-01 00:00:00" ) ) , new Date ( "2024-02-29 00:00:00" ) )
156156 deepStrictEqual ( next ( "0 0 29 2 *" , new Date ( "2025-01-01 00:00:00" ) ) , new Date ( "2028-02-29 00:00:00" ) )
0 commit comments