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

Method subtract

src/pendulum/date.py:208–219  ·  view source on GitHub ↗

Remove duration from the instance. :param years: The number of years :param months: The number of months :param weeks: The number of weeks :param days: The number of days

(
        self, years: int = 0, months: int = 0, weeks: int = 0, days: int = 0
    )

Source from the content-addressed store, hash-verified

206 return self.__class__(dt.year, dt.month, dt.day)
207
208 def subtract(
209 self, years: int = 0, months: int = 0, weeks: int = 0, days: int = 0
210 ) -> Self:
211 """
212 Remove duration from the instance.
213
214 :param years: The number of years
215 :param months: The number of months
216 :param weeks: The number of weeks
217 :param days: The number of days
218 """
219 return self.add(years=-years, months=-months, weeks=-weeks, days=-days)
220
221 def _add_timedelta(self, delta: timedelta) -> Self:
222 """

Callers 2

_subtract_timedeltaMethod · 0.95
previousMethod · 0.95

Calls 1

addMethod · 0.95

Tested by

no test coverage detected