MCPcopy Create free account
hub / github.com/python-pendulum/pendulum / _last_of_year

Method _last_of_year

src/pendulum/date.py:687–694  ·  view source on GitHub ↗

Modify to the last occurrence of a given day of the week in the current year. If no day_of_week is provided, modify to the last day of the year. Use the supplied consts to indicate the desired day_of_week, ex. pendulum.MONDAY.

(self, day_of_week: WeekDay | None = None)

Source from the content-addressed store, hash-verified

685 return self.set(month=1).first_of("month", day_of_week)
686
687 def _last_of_year(self, day_of_week: WeekDay | None = None) -> Self:
688 """
689 Modify to the last occurrence of a given day of the week
690 in the current year. If no day_of_week is provided,
691 modify to the last day of the year. Use the supplied consts
692 to indicate the desired day_of_week, ex. pendulum.MONDAY.
693 """
694 return self.set(month=MONTHS_PER_YEAR).last_of("month", day_of_week)
695
696 def _nth_of_year(self, nth: int, day_of_week: WeekDay) -> Self | None:
697 """

Callers

nothing calls this directly

Calls 2

setMethod · 0.95
last_ofMethod · 0.45

Tested by

no test coverage detected