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

Method diff_for_humans

src/pendulum/time.py:241–261  ·  view source on GitHub ↗

Get the difference in a human readable format in the current locale. :param dt: The time to subtract from :param absolute: removes time difference modifiers ago, after, etc :param locale: The locale to use for localization

(
        self,
        other: time | None = None,
        absolute: bool = False,
        locale: str | None = None,
    )

Source from the content-addressed store, hash-verified

239 return klass(microseconds=us2 - us1)
240
241 def diff_for_humans(
242 self,
243 other: time | None = None,
244 absolute: bool = False,
245 locale: str | None = None,
246 ) -> str:
247 """
248 Get the difference in a human readable format in the current locale.
249
250 :param dt: The time to subtract from
251 :param absolute: removes time difference modifiers ago, after, etc
252 :param locale: The locale to use for localization
253 """
254 is_now = other is None
255
256 if is_now:
257 other = pendulum.now().time()
258
259 diff = self.diff(other)
260
261 return pendulum.format_diff(diff, is_now, absolute, locale)
262
263 # Compatibility methods
264

Callers 15

diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45
diff_for_humansFunction · 0.45

Calls 3

diffMethod · 0.95
timeMethod · 0.80
nowMethod · 0.80

Tested by 15

diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36
diff_for_humansFunction · 0.36