Returns an instance set to the last occurrence of a given day of the week in the current unit. If no day_of_week is provided, modify to the last day of the unit. Use the supplied consts to indicate the desired day_of_week, ex. DateTime.MONDAY. Suppor
(self, unit: str, day_of_week: WeekDay | None = None)
| 979 | return cast("Self", getattr(self, f"_first_of_{unit}")(day_of_week)) |
| 980 | |
| 981 | def last_of(self, unit: str, day_of_week: WeekDay | None = None) -> Self: |
| 982 | """ |
| 983 | Returns an instance set to the last occurrence |
| 984 | of a given day of the week in the current unit. |
| 985 | If no day_of_week is provided, modify to the last day of the unit. |
| 986 | Use the supplied consts to indicate the desired day_of_week, |
| 987 | ex. DateTime.MONDAY. |
| 988 | |
| 989 | Supported units are month, quarter and year. |
| 990 | """ |
| 991 | if unit not in ["month", "quarter", "year"]: |
| 992 | raise ValueError(f'Invalid unit "{unit}" for first_of()') |
| 993 | |
| 994 | return cast("Self", getattr(self, f"_last_of_{unit}")(day_of_week)) |
| 995 | |
| 996 | def nth_of(self, unit: str, nth: int, day_of_week: WeekDay) -> Self: |
| 997 | """ |
no outgoing calls
no test coverage detected