Skip to content

implement fromisoformat method for datetime class #134

Description

@5j9

fromisoformat was added in Python 3.7 for date, datetime, and time classes. jdatettime already supports it for time (which inherits from the built-in pyhton class) and recently implemented it for date, but still needs to implement it for datetime class.

Also note that in Python 3.11 fromisoformat is more forgiving on the format of the input strings, for example date.fromisoformat now accepts YYYYMMDD format:

from datetime import date

date.fromisoformat('2019-12-04')
datetime.date(2019, 12, 4)

date.fromisoformat('20191204')
datetime.date(2019, 12, 4)

date.fromisoformat('2021-W01-1')
datetime.date(2021, 1, 4)

Changed in version 3.11: Previously, this method only supported the format YYYY-MM-DD.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions