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,
)
| 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 |