Format date and time labels always using invariant culture#1007
Conversation
There was a problem hiding this comment.
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 toDateTime.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.
There was a problem hiding this comment.
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
DateTimelabels viad.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.
There was a problem hiding this comment.
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 passCultureInfo.InvariantCulturefor:- time-only labels (
HH:mm:ss) - short-date labels (
MM/dd/yy) - date+time labels (
yyyy-MM-dd HH:mm:ss)
- time-only labels (
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.
gedinakova
left a comment
There was a problem hiding this comment.
As discussed, test specific files should be created instead of amending the general purpose ones.
Format date and time labels always using invariant culture