diff --git a/src/apscheduler/triggers/cron/expressions.py b/src/apscheduler/triggers/cron/expressions.py index a21af7b8..5443367f 100644 --- a/src/apscheduler/triggers/cron/expressions.py +++ b/src/apscheduler/triggers/cron/expressions.py @@ -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}" \ No newline at end of file + return f"last-{self.last_day}" diff --git a/src/apscheduler/triggers/cron/fields.py b/src/apscheduler/triggers/cron/fields.py index 543955cc..a777fa62 100644 --- a/src/apscheduler/triggers/cron/fields.py +++ b/src/apscheduler/triggers/cron/fields.py @@ -13,8 +13,8 @@ from .expressions import ( WEEKDAYS, AllExpression, - LastNDayOfMonthExpression, LastDayOfMonthExpression, + LastNDayOfMonthExpression, MonthRangeExpression, RangeExpression, WeekdayPositionExpression, @@ -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__ = ()