Skip to content

Format date and time labels always using invariant culture#1007

Open
wnvko wants to merge 1 commit into
25.2from
mvenkov/fix-dates
Open

Format date and time labels always using invariant culture#1007
wnvko wants to merge 1 commit into
25.2from
mvenkov/fix-dates

Conversation

@wnvko
Copy link
Copy Markdown

@wnvko wnvko commented Apr 30, 2026

Format date and time labels always using invariant culture

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates date/time label formatting in the code-gen library so the primary DateTime.ToString(...) calls use CultureInfo.InvariantCulture, making output consistent regardless of the current UI culture.

Changes:

  • Added using System.Globalization; to relevant label formatter samples.
  • Updated DateTime.ToString(format) calls to DateTime.ToString(format, CultureInfo.InvariantCulture) for time, short date, and date+time formatters (WPF + Windows Forms variants).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
code-gen-library/FormatDateLabelAsTime/WindowsForms.cs Uses InvariantCulture when formatting time labels.
code-gen-library/FormatDateLabelAsTime/WPF.cs Uses InvariantCulture when formatting time labels.
code-gen-library/FormatDateLabelAsShortDate/WindowsForms.cs Uses InvariantCulture when formatting short date labels.
code-gen-library/FormatDateLabelAsShortDate/WPF.cs Uses InvariantCulture when formatting short date labels.
code-gen-library/FormatDateLabelAsDateAndTime/WindowsForms.cs Uses InvariantCulture when formatting date+time labels.
code-gen-library/FormatDateLabelAsDateAndTime/WPF.cs Uses InvariantCulture when formatting date+time labels.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread code-gen-library/FormatDateLabelAsTime/WPF.cs
Comment thread code-gen-library/FormatDateLabelAsTime/WindowsForms.cs
Comment thread code-gen-library/FormatDateLabelAsShortDate/WPF.cs
Comment thread code-gen-library/FormatDateLabelAsShortDate/WindowsForms.cs
Comment thread code-gen-library/FormatDateLabelAsDateAndTime/WPF.cs
Comment thread code-gen-library/FormatDateLabelAsDateAndTime/WindowsForms.cs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the code-gen library’s date/time label formatting helpers (WPF + WindowsForms variants) to format DateTime values using CultureInfo.InvariantCulture, avoiding culture-dependent date (/) and time (:) separators.

Changes:

  • Add using System.Globalization; to relevant label-formatting snippets.
  • Format DateTime labels via d.ToString(format, CultureInfo.InvariantCulture) for time, short date, and date+time handlers.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
code-gen-library/FormatDateLabelAsTime/WindowsForms.cs Uses invariant culture when formatting time labels (HH:mm:ss).
code-gen-library/FormatDateLabelAsTime/WPF.cs Uses invariant culture when formatting time labels (HH:mm:ss).
code-gen-library/FormatDateLabelAsShortDate/WindowsForms.cs Uses invariant culture when formatting short-date labels (MM/dd/yy).
code-gen-library/FormatDateLabelAsShortDate/WPF.cs Uses invariant culture when formatting short-date labels (MM/dd/yy).
code-gen-library/FormatDateLabelAsDateAndTime/WindowsForms.cs Uses invariant culture when formatting date+time labels (yyyy-MM-dd HH:mm:ss).
code-gen-library/FormatDateLabelAsDateAndTime/WPF.cs Uses invariant culture when formatting date+time labels (yyyy-MM-dd HH:mm:ss).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread code-gen-library/FormatDateLabelAsTime/WindowsForms.cs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the code-gen library’s date/time axis label formatter handlers (WPF + Windows Forms variants) to format DateTime values using CultureInfo.InvariantCulture, ensuring consistent output regardless of the current UI culture.

Changes:

  • Add using System.Globalization; to the affected formatter templates.
  • Update DateTime.ToString(...) calls to pass CultureInfo.InvariantCulture for:
    • time-only labels (HH:mm:ss)
    • short-date labels (MM/dd/yy)
    • date+time labels (yyyy-MM-dd HH:mm:ss)

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
code-gen-library/FormatDateLabelAsTime/WindowsForms.cs Uses invariant culture when formatting time labels in WinForms handler.
code-gen-library/FormatDateLabelAsTime/WPF.cs Uses invariant culture when formatting time labels in WPF handler.
code-gen-library/FormatDateLabelAsShortDate/WindowsForms.cs Uses invariant culture when formatting short-date labels in WinForms handler.
code-gen-library/FormatDateLabelAsShortDate/WPF.cs Uses invariant culture when formatting short-date labels in WPF handler.
code-gen-library/FormatDateLabelAsDateAndTime/WindowsForms.cs Uses invariant culture when formatting date+time labels in WinForms handler.
code-gen-library/FormatDateLabelAsDateAndTime/WPF.cs Uses invariant culture when formatting date+time labels in WPF handler.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@gedinakova gedinakova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, test specific files should be created instead of amending the general purpose ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants