KEMBAR78
datetime.datetime.isoformat parses input incorrectly · Issue #115225 · python/cpython · GitHub
Skip to content

datetime.datetime.isoformat parses input incorrectly #115225

@xitop

Description

@xitop

Bug report

Bug description:

import datetime as dt
print(dt.time.fromisoformat("T1250.50"))

Actual result is 12:50:00.500000, but according to ISO 8601 the string represents 12:50:30
(50 and half minutes, format "HHMM.mmm", because "a decimal fraction may be added
to the lowest order time element present"
)

if partial minutes are not supported by Python as stated in the docs, a ValueError should be raised.

Affected are versions 3.10+.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions