Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Xu Jay committed Nov 14, 2024
2 parents 3107d94 + b8de248 commit 497cb96
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/apscheduler/triggers/cron/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ def __init__(self, last_day):

def get_next_value(self, date, field):
currval = field.get_value(date)
nextval = monthrange(date.year, date.month)[1]-self.last_day
nextval = monthrange(date.year, date.month)[1] - self.last_day

return nextval if currval <= nextval else None

def __str__(self):
return f"last-{self.last_day}"
return f"last-{self.last_day}"
9 changes: 7 additions & 2 deletions src/apscheduler/triggers/cron/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from .expressions import (
WEEKDAYS,
AllExpression,
LastNDayOfMonthExpression,
LastDayOfMonthExpression,
LastNDayOfMonthExpression,
MonthRangeExpression,
RangeExpression,
WeekdayPositionExpression,
Expand Down Expand Up @@ -123,7 +123,12 @@ def get_value(self, dateval: datetime) -> int:


class DayOfMonthField(
BaseField, extra_compilers=(WeekdayPositionExpression, LastNDayOfMonthExpression, LastDayOfMonthExpression)
BaseField,
extra_compilers=(
WeekdayPositionExpression,
LastNDayOfMonthExpression,
LastDayOfMonthExpression,
),
):
__slots__ = ()

Expand Down

0 comments on commit 497cb96

Please sign in to comment.