Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 21, 2025

The documentation for custom date and time format strings incorrectly presented the genitive names behavior as a version-specific feature introduced in .NET 8. Based on technical review, the actual behavior is:

  • MMMM: Genitive behavior works correctly in both .NET Framework and .NET when "d" or "dd" specifiers are present
  • MMM: Genitive behavior is broken in .NET Framework (a known bug) but works correctly in .NET

Changes Made

Updated the documentation to accurately reflect this behavior:

  1. MMMM format specifier: Removed version-specific notes since the genitive behavior works consistently across all supported versions
  2. MMM format specifier: Clarified that the genitive behavior is a .NET Framework bug that was fixed in .NET, rather than presenting it as a new feature

Example of the Issue

In .NET Framework, a format string like "d MMM" will always use AbbreviatedMonthNames (the bug), whereas in .NET it correctly uses AbbreviatedMonthGenitiveNames when the "d" specifier is present. The MMMM specifier works correctly in both versions.

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.

@adegeo
Copy link
Contributor

adegeo commented Aug 25, 2025

@copilot we've received clarification on how this actually works. There is no difference with MMMM in .NET Framework and .NET, so remove any reference to there being a difference or that behavior changed starting with X version. With MMM there is a difference, it doesn't work in .NET Framework. Instead of mentioning that it works in .NET, mention that this is a bug with .NET Framework that's fixed in .NET.

- Remove version notes from MMMM as it works correctly in both .NET Framework and .NET
- Update MMM to clarify it's a .NET Framework bug that was fixed in .NET

Co-authored-by: adegeo <67293991+adegeo@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 25, 2025

@copilot we've received clarification on how this actually works. There is no difference with MMMM in .NET Framework and .NET, so remove any reference to there being a difference or that behavior ch...

Updated the documentation as requested:

  • MMMM: Removed all version-specific references since genitive behavior works correctly in both .NET Framework and .NET
  • MMM: Changed to clarify this is a .NET Framework bug that was fixed in .NET (rather than presenting it as a version-specific feature)

The documentation now accurately reflects that MMMM works consistently across versions, while MMM has a known bug in .NET Framework that was resolved in .NET. Commit: a9610a7

@Copilot Copilot AI changed the title Add .NET 8+ version notes for genitive names behavior in custom date/time format strings Correct .NET Framework bug documentation for MMM format specifier genitive behavior Aug 25, 2025
@Copilot Copilot AI requested a review from adegeo August 25, 2025 21:12
Copilot finished work on behalf of adegeo August 25, 2025 21:12
@@ -70,8 +70,8 @@ In parsing operations, custom date and time format strings can be used with the
| "mm" | The minute, from 00 to 59.<br /><br /> More information: [The "mm" Custom Format Specifier](#mmSpecifier). | 2009-06-15T01:09:30 -> 09<br /><br /> 2009-06-15T01:45:30 -> 45 |
| "M" | The month, from 1 to 12.<br /><br /> More information: [The "M" Custom Format Specifier](#M_Specifier). | 2009-06-15T13:45:30 -> 6 |
| "MM" | The month, from 01 to 12.<br /><br /> More information: [The "MM" Custom Format Specifier](#MM_Specifier). | 2009-06-15T13:45:30 -> 06 |
| "MMM" | The abbreviated name of the month.<br /><br /> More information: [The "MMM" Custom Format Specifier](#MMM_Specifier). | 2009-06-15T13:45:30 -> Jun (en-US)<br /><br /> 2009-06-15T13:45:30 -> juin (fr-FR)<br /><br /> 2009-06-15T13:45:30 -> Jun (zu-ZA) |
| "MMMM" | The full name of the month.<br /><br /> More information: [The "MMMM" Custom Format Specifier](#MMMM_Specifier). | 2009-06-15T13:45:30 -> June (en-US)<br /><br /> 2009-06-15T13:45:30 -> juni (da-DK)<br /><br /> 2009-06-15T13:45:30 -> uJuni (zu-ZA) |
| "MMM" | The abbreviated name of the month. When used with "d" or "dd" specifiers, uses genitive names (note: this is a known bug in .NET Framework that was fixed in .NET).<br /><br /> More information: [The "MMM" Custom Format Specifier](#MMM_Specifier). | 2009-06-15T13:45:30 -> Jun (en-US)<br /><br /> 2009-06-15T13:45:30 -> juin (fr-FR)<br /><br /> 2009-06-15T13:45:30 -> Jun (zu-ZA) |
Copy link
Member

@tarekgh tarekgh Aug 25, 2025

Choose a reason for hiding this comment

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

(note: this is a known bug in .NET Framework that was fixed in .NET)

Instead of saying this is a known bug in .NET Framework that was fixed in .NET can we say This was a known issue in the .NET Framework that has been resolved in .NET.

Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

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

Added a small suggestion, LGTM otherwise.

Thanks!

@adegeo adegeo enabled auto-merge (squash) August 26, 2025 21:25
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