def diff_for_humans( self, other=None, # type: Optional[DateTime] absolute=False, # type: bool locale=None, # type: Optional[str] ): # type: (...) -> str """ Get the difference in a human readable format in the current locale. When comparing a value in the past to default now: 1 day ago 5 months ago When comparing a value in the future to default now: 1 day from now 5 months from now When comparing a value in the past to another value: 1 day before 5 months before When comparing a value in the future to another value: 1 day after 5 months after """ is_now = other is None if is_now: other = self.now() diff = self.diff(other) return pendulum.format_diff(diff, is_now, absolute, locale)
def diff_for_humans( self, other=None, # type: Union['DateTime', None] absolute=False, # type: bool locale=None, # type:Union[str, None] ): # type: (...) -> False """ Get the difference in a human readable format in the current locale. When comparing a value in the past to default now: 1 day ago 5 months ago When comparing a value in the future to default now: 1 day from now 5 months from now When comparing a value in the past to another value: 1 day before 5 months before When comparing a value in the future to another value: 1 day after 5 months after """ is_now = other is None if is_now: other = self.now() diff = self.diff(other) return pendulum.format_diff(diff, is_now, absolute, locale)
def diff_for_humans(self, other=None, absolute=False, locale=None): """ Get the difference in a human readable format in the current locale. :type other: Time or time :param absolute: removes time difference modifiers ago, after, etc :type absolute: bool :param locale: The locale to use for localization :type locale: str :rtype: str """ is_now = other is None if is_now: other = pendulum.now().time() diff = self.diff(other) return pendulum.format_diff(diff, is_now, absolute, locale)
def diff_for_humans(self, other=None, absolute=False, locale=None): """ Get the difference in a human readable format in the current locale. When comparing a value in the past to default now: 1 day ago 5 months ago When comparing a value in the future to default now: 1 day from now 5 months from now When comparing a value in the past to another value: 1 day before 5 months before When comparing a value in the future to another value: 1 day after 5 months after :type other: Date :param absolute: removes time difference modifiers ago, after, etc :type absolute: bool :param locale: The locale to use for localization :type locale: str :rtype: str """ is_now = other is None if is_now: other = self.today() diff = self.diff(other) return pendulum.format_diff(diff, is_now, absolute, locale)