Skip to content

[Repo Assist] Fix DateTime locale-dependent formatting in FSI output — closes #639#643

Merged
dsyme merged 2 commits intomasterfrom
repo-assist/fix-issue-639-datetime-locale-ci-49f926ecc1aae8cd
Mar 18, 2026
Merged

[Repo Assist] Fix DateTime locale-dependent formatting in FSI output — closes #639#643
dsyme merged 2 commits intomasterfrom
repo-assist/fix-issue-639-datetime-locale-ci-49f926ecc1aae8cd

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Repo Assist — automated bug fix.

Summary

Fixes the Windows CI failure reported in #639, where the test series with datetime keys preserves time in Format was failing because formatKey used key.ToString() for DateTime values with a time component. On Windows with an AM/PM locale this produced "9:30:00 AM" instead of the expected "09:30:00".

Root Cause

Formatting.formatKey had two paths:

  1. DateTime with TimeOfDay = 00:00:00 → formatted with the current culture's short date format ("d")
  2. Everything else → key.ToString()locale-sensitive

Path 2 is used for DateTime keys with a non-zero time component. On Windows with a culture that uses AM/PM (e.g. en-US), key.ToString() produces "1/1/2023 9:30:00 AM", which does not contain the "09:30:00" substring the test was asserting.

Fix

Added an explicit case for DateTime values with a non-zero time component that formats them as "yyyy-MM-dd HH:mm:ss" using CultureInfo.InvariantCulture:

| :? DateTime as dt ->
    dt.ToString("yyyy-MM-dd HH:mm:ss", Globalization.CultureInfo.InvariantCulture)

This gives a consistent, unambiguous, zero-padded 24-hour format on all platforms and locales.

Trade-offs

  • Date-only keys continue to use the current culture's short-date format (unchanged behaviour).
  • DateTime-with-time keys now use ISO-8601-adjacent format, which is more predictable but is a minor display change from whatever the user's locale previously showed.

Test Status

✅ All 612 tests pass on Linux (dotnet test tests/Deedle.Tests/Deedle.Tests.fsproj -c Release).
The updated test also asserts "AM" and "PM" are absent from the output.

Closes #639

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@30f2254f2a7a944da1224df45d181a3f8faefd0d

Use an explicit invariant-culture format ("yyyy-MM-dd HH:mm:ss") for
DateTime keys that have a non-zero time component, instead of relying on
key.ToString() which is locale-sensitive. On Windows with an AM/PM locale
this was producing "9:30:00 AM" instead of the 24-hour form "09:30:00",
causing the CI test to fail.

The date-only path (TimeOfDay = 00:00:00) retains the existing short-date
CurrentCulture format because that path never contained the assertion that
was failing.

Updated the test to verify the full invariant format and explicitly assert
the absence of AM/PM suffixes.

Co-authored-by: Copilot <[email protected]>
This was referenced Mar 17, 2026
github-actions Bot added a commit that referenced this pull request Mar 18, 2026
The test 'series with datetime keys preserves time in Format' was failing
on Windows because DateTime.ToString() uses the locale's AM/PM format.
Apply the same fix as PR #643: use 'yyyy-MM-dd HH:mm:ss' with
InvariantCulture for DateTime keys that have a non-zero time component.

Co-authored-by: Copilot <[email protected]>
@dsyme dsyme marked this pull request as ready for review March 18, 2026 14:07
@dsyme dsyme merged commit 4aaca5f into master Mar 18, 2026
2 checks passed
@dsyme dsyme deleted the repo-assist/fix-issue-639-datetime-locale-ci-49f926ecc1aae8cd branch March 18, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing CI

1 participant