Skip to content

Fix the formatting of the ar-SA culture date in "Working with calendars"#53877

Open
BartoszKlonowski wants to merge 4 commits into
dotnet:mainfrom
BartoszKlonowski:53856/fix/ar-sa-calendar-format
Open

Fix the formatting of the ar-SA culture date in "Working with calendars"#53877
BartoszKlonowski wants to merge 4 commits into
dotnet:mainfrom
BartoszKlonowski:53856/fix/ar-sa-calendar-format

Conversation

@BartoszKlonowski
Copy link
Copy Markdown
Contributor

@BartoszKlonowski BartoszKlonowski commented May 18, 2026

This pull request fixes #53856 by:

  • fixing the formatting of the date when the culture is changed to the RTL formats,
  • adjusting the example output so that separators and number of digits is same for every culture or calendar,
  • mentioning the fact of manually setting arSA.DateTimeFormat.Calendar to the proper calendar every time the culture is changed.

Internal previews

📄 File 🔗 Preview link
docs/standard/datetime/working-with-calendars.md Work with calendars

@BartoszKlonowski BartoszKlonowski requested review from a team, BillWagner and adegeo as code owners May 18, 2026 18:10
@dotnetrepoman dotnetrepoman Bot added this to the May 2026 milestone May 18, 2026
@dotnet-policy-service dotnet-policy-service Bot added dotnet-fundamentals/svc community-contribution Indicates PR is created by someone from the .NET community. labels May 18, 2026
Copy link
Copy Markdown

@JVimes JVimes left a comment

Choose a reason for hiding this comment

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

I left a couple comments. I think the only change necessary is switching to the custom format strings. Thanks!

Comment thread docs/standard/datetime/working-with-calendars.md Outdated
Copy link
Copy Markdown
Contributor

@adegeo adegeo left a comment

Choose a reason for hiding this comment

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

@BartoszKlonowski @JVimes

Hello. Thank you for the contribution! I don't think this is the correct solution though. There are a few things at play here.

  1. The example is showing the culture specific short-date format string. By removing that and forcing a Gregorian format, that kind of defeats the purpose of demonstrating how a culture's calendar and format is different.

  2. The original ???? error is because the terminal being used is probably older and it can't display the glyphs used by the culture.

  3. The reason the strings are so different in format is because the last time the example was updated was for .NET Framework. In .NET 10 (or at some point between the two versions) the culture format string has been changed.

I feel like the real solution is to just update the expected results with what is current, then add a small note that says the output may differ based on Operating System and version of .NET and .NET Framework.

Also, the corresponding VB example needs to be updated.

Update: The reason the snippets are failing is that it's in our old snippet area and format. I can help fix that when you're ready.

@JVimes
Copy link
Copy Markdown

JVimes commented May 19, 2026

Thank you, @adegeo. I confirm the question marks are placeholders for glyphs. @BartoszKlonowski, the glyphs show up if I call Console.OutputEncoding = Encoding.UTF8; before writing to console, so probably that should be in the code sample.

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

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-fundamentals/svc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Example code output different than when run locally

3 participants