add: 添加每月最后一天调度

This commit is contained in:
2026-06-20 11:46:50 +08:00
parent bce0c6188e
commit 161f266829
9 changed files with 49 additions and 23 deletions
+14
View File
@@ -48,6 +48,20 @@ class ComputeNextRunAtTest(unittest.TestCase):
"2026-03-31T23:00:00Z",
)
def test_monthly_last_day_uses_current_month_end(self):
after = datetime(2026, 2, 1, 0, 0, tzinfo=timezone.utc)
self.assertEqual(
compute_next_run_at("monthly", "23:00", 0, after, monthday=0),
"2026-02-28T23:00:00Z",
)
def test_monthly_last_day_rolls_forward_when_current_month_end_passed(self):
after = datetime(2026, 2, 28, 23, 0, tzinfo=timezone.utc)
self.assertEqual(
compute_next_run_at("monthly", "23:00", 0, after, monthday=0),
"2026-03-31T23:00:00Z",
)
def test_timezone_offset_is_applied_from_local_schedule_time(self):
after = datetime(2026, 6, 20, 12, 0, tzinfo=timezone.utc)
self.assertEqual(