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

Method diff

src/pendulum/date.py:281–291  ·  view source on GitHub ↗

Returns the difference between two Date objects as an Interval. :param dt: The date to compare to (defaults to today) :param abs: Whether to return an absolute interval or not

(self, dt: date | None = None, abs: bool = True)

Source from the content-addressed store, hash-verified

279 # DIFFERENCES
280
281 def diff(self, dt: date | None = None, abs: bool = True) -> Interval[Date]:
282 """
283 Returns the difference between two Date objects as an Interval.
284
285 :param dt: The date to compare to (defaults to today)
286 :param abs: Whether to return an absolute interval or not
287 """
288 if dt is None:
289 dt = self.today()
290
291 return Interval(self, Date(dt.year, dt.month, dt.day), absolute=abs)
292
293 def diff_for_humans(
294 self,

Callers 6

ageMethod · 0.95
closestMethod · 0.95
farthestMethod · 0.95
diff_for_humansMethod · 0.95
averageMethod · 0.95
__sub__Method · 0.45

Calls 3

todayMethod · 0.95
IntervalClass · 0.90
DateClass · 0.85

Tested by

no test coverage detected