When nanoseconds are non-zero, include them in Display output as
`.NNNNNNNNN` between seconds and the offset. This avoids silently
dropping sub-second precision from the formatted representation.
Replace hand-rolled format_offset_colon / format_for_assert helpers
with the new Display impls. Replace local expect_in_range_datetime
test helpers with ParsedDateTime::expect_in_range().
The Timestamp variant was #[cfg(test)]-gated dead code outside tests.
The parse_timestamp function already calls set_timestamp on the builder
directly, bypassing the TryFrom<Vec<Item>> path. Remove the variant and
refactor builder tests to exercise set_timestamp directly instead.
In GNU if using date with relative Months with the -d flag and the target Month does not have the source day (for example 31) GNU overflows the diff in days.
In case a string such as "now + 1.5 seconds" was parsed we were failing.
This happened because after processing now, the parser was getting
to the point in which the string contained "+ 1.5", and once the sign
was processed, the remaining " 1.5" string conained a space that was
causing sec_and_nsec to fail.
Instead of failing at this point, just strip the spaces after the sign has
been processed.
Note in fact that "0+0.0 seconds" was working fine
Closes: https://github.com/uutils/coreutils/issues/8618
- Add `TryFrom<Vec<Items>>` implementation for `DateTimeBuilder`
to improve code separation and reusability.
- Replace manual parsing loop in `parse_items()` with
`repeat_until` combinator for cleaner approach.
- Allow timestamp strings ending with whitespaces.