Skip to content

[Feature Request]: Treat java duration as foreign variant of datetime.timedelta #1217

Open

Description

@ftreede

Describe the feature

Similar to what is already possible for java.time.ZonedDateTime etc, a java.time.Duration instance should be seen as an instance of datetime.timedelta in python.

Notably timedelta objects already implicitly convert to java duration objects, it's just the other way round that is missing.

Expected behavior

Given a java method

java.time.Duration getDuration() {...}

A python side call should get an interop object:

duration = javaobject.getDuration()
# isinstance(duration, datetime.timedelta) returns True

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions