Skip to content

fix: TOML parsing of fractional seconds#59999

Merged
KristofferC merged 1 commit intoJuliaLang:masterfrom
haakon-e:he/fix-toml-parsing-of-fractional
Oct 31, 2025
Merged

fix: TOML parsing of fractional seconds#59999
KristofferC merged 1 commit intoJuliaLang:masterfrom
haakon-e:he/fix-toml-parsing-of-fractional

Conversation

@haakon-e
Copy link
Copy Markdown
Contributor

@haakon-e haakon-e commented Oct 30, 2025

fix a bug in which parsing the digits after the decimal point of a (date-)time like "00:00:00.12" were interpreted as "12 milliseconds" instead of "0.12 seconds". Now, the fractional part is correctly parsed as a fraction of a second, then correctly converted to milliseconds. As before, only the first three digits after the decimal point are considered.

Closes #59997


With a local build of this PR, the example from the above issue now evaluates to:

julia> t2 = TOML.parse("""time = 00:00:00.2""")
Dict{String, Any} with 1 entry:
  "time" => 00:00:00.2

julia> millisecond(t2["time"])
200

@KristofferC KristofferC added backport 1.10 Change should be backported to the 1.10 release backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13 labels Oct 30, 2025
- fix a bug in which parsing the digits after the
decimal point of a (date-)time like "00:00:00.12"
were interpreted as "12 milliseconds" instead of
"0.12 seconds". Now, the fractional part is
correctly parsed as a fraction of a second, then
correctly converted to milliseconds.
As before, only the first three digits after
the decimal point are considered.
@haakon-e haakon-e force-pushed the he/fix-toml-parsing-of-fractional branch from 5d96e17 to 938b37d Compare October 30, 2025 23:22
@haakon-e
Copy link
Copy Markdown
Contributor Author

This PR works for me locally. I haven't contributed a bugfix to julia before, so I would appreciate any guidance for additional components needed to merge this (e.g. update NEWS file?)

@KristofferC KristofferC merged commit 906d64e into JuliaLang:master Oct 31, 2025
8 checks passed
@KristofferC KristofferC added bugfix This change fixes an existing bug TOML labels Oct 31, 2025
@KristofferC
Copy link
Copy Markdown
Member

There is typically no need for NEWS entry for bugfixes like this. Thanks for the contribution!

KristofferC pushed a commit that referenced this pull request Nov 5, 2025
fix a bug in which parsing the digits after the decimal point of a
(date-)time like "00:00:00.12" were interpreted as "12 milliseconds"
instead of "0.12 seconds". Now, the fractional part is correctly parsed
as a fraction of a second, then correctly converted to milliseconds. As
before, only the first three digits after the decimal point are
considered.

Closes #59997

---

With a local build of this PR, the example from the above issue now
evaluates to:
```julia
julia> t2 = TOML.parse("""time = 00:00:00.2""")
Dict{String, Any} with 1 entry:
  "time" => 00:00:00.2

julia> millisecond(t2["time"])
200
```

(cherry picked from commit 906d64e)
@KristofferC KristofferC mentioned this pull request Nov 5, 2025
17 tasks
KristofferC pushed a commit that referenced this pull request Nov 7, 2025
fix a bug in which parsing the digits after the decimal point of a
(date-)time like "00:00:00.12" were interpreted as "12 milliseconds"
instead of "0.12 seconds". Now, the fractional part is correctly parsed
as a fraction of a second, then correctly converted to milliseconds. As
before, only the first three digits after the decimal point are
considered.

Closes #59997

---

With a local build of this PR, the example from the above issue now
evaluates to:
```julia
julia> t2 = TOML.parse("""time = 00:00:00.2""")
Dict{String, Any} with 1 entry:
  "time" => 00:00:00.2

julia> millisecond(t2["time"])
200
```

(cherry picked from commit 906d64e)
@KristofferC KristofferC mentioned this pull request Nov 7, 2025
35 tasks
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Nov 21, 2025
@KristofferC KristofferC removed the backport 1.13 Change should be backported to release-1.13 label Nov 28, 2025
@DilumAluthge DilumAluthge mentioned this pull request Jan 19, 2026
71 tasks
kpamnany pushed a commit to RelationalAI/julia that referenced this pull request Jan 21, 2026
fix a bug in which parsing the digits after the decimal point of a
(date-)time like "00:00:00.12" were interpreted as "12 milliseconds"
instead of "0.12 seconds". Now, the fractional part is correctly parsed
as a fraction of a second, then correctly converted to milliseconds. As
before, only the first three digits after the decimal point are
considered.

Closes JuliaLang#59997

---

With a local build of this PR, the example from the above issue now
evaluates to:
```julia
julia> t2 = TOML.parse("""time = 00:00:00.2""")
Dict{String, Any} with 1 entry:
  "time" => 00:00:00.2

julia> millisecond(t2["time"])
200
```

(cherry picked from commit 906d64e)
@KristofferC KristofferC mentioned this pull request Feb 20, 2026
45 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.10 Change should be backported to the 1.10 release bugfix This change fixes an existing bug TOML

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistency between DateTime and TOML string parsing of fractional seconds

3 participants