fix(date): keep POSIX '.' in custom --date fractional seconds - #1227
Open
pnavais wants to merge 1 commit into
Open
fix(date): keep POSIX '.' in custom --date fractional seconds#1227pnavais wants to merge 1 commit into
pnavais wants to merge 1 commit into
Conversation
PR lsd-rs#820 applied format_localized() to DateFlag::Formatted, which uses a locale decimal separator (',' in es_ES/de_DE/fr_FR). Custom strftime formats and the nanos integration test expect a POSIX '.'. Use non-localized format() for custom formats; DateFlag::Locale still uses format_localized(). Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After #820, custom
--date/TIME_STYLE=+…formats went throughformat_localized(). Chrono then uses the locale decimal separator for%.Nf, so locales likees_ES,de_DE, andfr_FRemit,instead of..That breaks:
+%Y-%m-%d %H:%M:%.3f)tests/integration.rs::test_date_custom_format_supports_nanos_with_length, which matchestestDateFormat\.[0-9]{3}DateFlag::Localestill usesformat_localized()for intentional localization. Custom formats use non-localizedformat()again.This may also explain failures reported in #1223 on macOS when the system locale is non-English (via
sys-locale), independent of APFS timestamp precision — that test only asserts the%.3fpattern appears twice; it does not require distinct nanosecond values.Verification
cargo test custom_format— unit + integration tests passcargo fmtTODO
cargo fmtdoc/samples(if applicable)doc/samples(if applicable)doc/samples(if applicable)