go-yaml / yaml

YAML support for the Go language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect RC3339 encoding

fgm opened this issue · comments

I seem to have stumbled upon an edge case with this timestamp: 2023-12-14T21:59:43.10-05:00

It is correctly deserialized but, when reserialized, becomes 2023-12-14T21:59:43.1-05:00

AFAICS, the current tests do not check what happens when the seconds are a multiple of 10.

Demo: https://go.dev/play/p/5QvgxPp-XMC

Actually this does not appear to be incorrect. Stdlib does the same, even documenting that RFC3339Nano drops zeroes so causing data not to sort. So, it's not actually a bug, just a known annoying feature.