Skip to content

Improve API for calculating difference between two datetimes #108

@ArneBachmannDLR

Description

@ArneBachmannDLR

I was expecting it to return a DateTimeDelta, but it is:

    def __sub__(self, other: _AwareDateTime) -> TimeDelta: ...

Hint: I want to compute (dt - UTCDateTime(1970, 1, 1)).days.

Update: this seems to work: (dt._py_dt - datetime.datetime(1970, 1, 1, tzinfo=datetime.UTC)).days

Metadata

Metadata

Assignees

Labels

discussionDiscussion is needed before proceedingenhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions