sdispater / pendulum

Python datetimes made easy
https://pendulum.eustace.io
MIT License
6.12k stars 372 forks source link

Add DateTime to typing for diff() #823

Open cp2boston opened 1 month ago

cp2boston commented 1 month ago

Feature Request

This doesn't affect operations, but it does cause my linter to flag. The diff method: ` def diff( # type: ignore[override] self, dt: datetime.datetime | None = None, abs: bool = True ) -> Interval: """ Returns the difference between two DateTime objects represented as an Interval. """ if dt is None: dt = self.now(self.tz)

    return Interval(self, dt, absolute=abs)

` will complain if the dt type is a Pendulum DateTime object.