Skip to content

Add .NET 8+ version notes for genitive names behavior in custom date/time format strings #48061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 21, 2025

The documentation for custom date and time format strings incorrectly stated that the MMM and MMMM format specifiers use genitive names (from AbbreviatedMonthGenitiveNames and MonthGenitiveNames properties) when "d" or "dd" custom format specifiers are present in the format string across all .NET versions.

This behavior actually only applies to .NET 8 and later versions, not .NET Framework 4.8 as originally documented.

Changes Made

Updated the documentation to clarify version-specific behavior:

  1. Table entries: Added version notes to the MMM and MMMM format specifier descriptions in the main table
  2. Section content: Added "(applies to .NET 8+)" notes to the specific sentences describing the genitive names behavior in both the MMM and MMMM sections

The changes are minimal and surgical - only 4 lines were modified to add the necessary version clarifications without changing any existing functionality descriptions.

Example of the Issue

In .NET Framework 4.8, a format string like "d MMM" will always use AbbreviatedMonthNames, whereas in .NET 8+ it will use AbbreviatedMonthGenitiveNames when the "d" specifier is present.

Fixes #48015.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Internal previews

📄 File 🔗 Preview link
docs/standard/base-types/custom-date-and-time-format-strings.md Custom date and time format strings

… format specifiers

Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Note about DateTimeFormatInfo.AbbreviatedMonthGenitiveNames usage is wrong for .NET Framework Add .NET 8+ version notes for genitive names behavior in custom date/time format strings Aug 21, 2025
@Copilot Copilot AI requested a review from adegeo August 21, 2025 22:10
Copilot finished work on behalf of adegeo August 21, 2025 22:10
@tarekgh
Copy link
Member

tarekgh commented Aug 21, 2025

The case of MMMM should be working fine. Only MMM is not working. It is really a bug, so I am not sure if it is worth documenting it.

@adegeo adegeo marked this pull request as ready for review August 21, 2025 23:44
@adegeo adegeo requested a review from a team as a code owner August 21, 2025 23:44
@tarekgh
Copy link
Member

tarekgh commented Aug 21, 2025

@adegeo I left the comment #48061 (comment).

@cremor
Copy link

cremor commented Aug 22, 2025

This behavior actually only applies to .NET 8 and later versions

Note that I didn't test .NET 7 or older versions of .NET Core. So this could also have been a change in a .NET version earlier than 8.

@tarekgh
Copy link
Member

tarekgh commented Aug 22, 2025

Note that I didn't test .NET 7 or older versions of .NET Core. So this could also have been a change in a .NET version earlier than 8.

This is fixed in .NET 5.0 But I think the doc is mentioning the currently supported version of the .NET.

dotnet/runtime#15035
dotnet/coreclr#21230

@adegeo
Copy link
Contributor

adegeo commented Aug 22, 2025

@tarekgh OK, so really it sounds like all of the "d, dd -- genitive" info for "MMM" should be removed, right?

@tarekgh
Copy link
Member

tarekgh commented Aug 22, 2025

OK, so really it sounds like all of the "d, dd -- genitive" info for "MMM" should be removed, right?

Here’s what I’m trying to say:

  • In .NET 5.0+, genitive month names work correctly with both MMM and MMMM.
  • In .NET Framework, genitive month names with MMMM work correctly as well.
  • In .NET Framework, genitive month names with MMM do NOT work correctly. This is a bug that was fixed in .NET 5.0.

So, we should keep the documentation for genitive month names with both MMM and MMMM as it is. The question is: should we explicitly document that MMM does not work in .NET Framework? I ask because this is clearly a bug, not intentional behavior, and it’s unlikely to ever be fixed in .NET Framework. If we consider it important to mention, I’m fine adding a note in the section to clarify that the MMM case is broken in .NET Framework.

@cremor
Copy link

cremor commented Aug 22, 2025

The question is: should we explicitly document that MMM does not work in .NET Framework?

Yes, please. That's the reason I created the issue. If it will never be changed in .NET Framework than it doesn't matter if the difference is because of a bug or a feature difference.

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.

Note about DateTimeFormatInfo.AbbreviatedMonthGenitiveNames usage is wrong for .NET Framework
5 participants