MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / end_of

Method end_of

src/pendulum/datetime.py:769–787  ·  view source on GitHub ↗

Returns a copy of the instance with the time reset with the following rules: * second: microsecond set to 999999 * minute: second set to 59 and microsecond set to 999999 * hour: minute and second set to 59 and microsecond set to 999999 * day: time to

(self, unit: str)

Source from the content-addressed store, hash-verified

767 return cast("Self", getattr(self, f"_start_of_{unit}")())
768
769 def end_of(self, unit: str) -> Self:
770 """
771 Returns a copy of the instance with the time reset
772 with the following rules:
773
774 * second: microsecond set to 999999
775 * minute: second set to 59 and microsecond set to 999999
776 * hour: minute and second set to 59 and microsecond set to 999999
777 * day: time to 23:59:59.999999
778 * week: date to last day of the week and time to 23:59:59.999999
779 * month: date to last day of the month and time to 23:59:59.999999
780 * year: date to last day of the year and time to 23:59:59.999999
781 * decade: date to last day of the decade and time to 23:59:59.999999
782 * century: date to last day of century and time to 23:59:59.999999
783 """
784 if unit not in self._MODIFIERS_VALID_UNITS:
785 raise ValueError(f'Invalid unit "{unit}" for end_of()')
786
787 return cast("Self", getattr(self, f"_end_of_{unit}")())
788
789 def _start_of_second(self) -> Self:
790 """

Callers 1

_end_of_weekMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected