You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using HybridGlobalization on iOS, the shortdate format does only contain just either one or two y's, which result in only a two-digit year when formatting dates.
Reproduction Steps
Set <HybridGlobalization>true</HybridGlobalization> in iOS csproj file and format some date with "short date" format (e.g. DateTime.Now.ToString("d"))
Expected behavior
new CultureInfo("de-DE").DateTimeFormat.ShortDatePattern == "dd.MM.yyyy"
new CultureInfo("en-US").DateTimeFormat.ShortDatePattern == "M/d/yyyy"
new CultureInfo("fa-IR").DateTimeFormat.ShortDatePattern == "yyyy/M/d"
Actual behavior
new CultureInfo("de-DE").DateTimeFormat.ShortDatePattern == "dd.MM.yy"
new CultureInfo("en-US").DateTimeFormat.ShortDatePattern == "M/d/yy"
new CultureInfo("fa-IR").DateTimeFormat.ShortDatePattern == "y/M/d"
Regression?
No response
Known Workarounds
No response
Configuration
.NET 8
Other information
A similar problem was reported a while back for Linux here and fixed here. To code is still in the repo:
tipa
changed the title
[iOS/HybridGlobalization] Force short date pattern to use yyyy on iOS
[iOS/HybridGlobalization] Force short date pattern to use yyyy
Mar 11, 2024
The fix was successfully backported and the .NET 8.0.5 servicing release contains the fix.
Edit. the fix didn't make the 8.0.5 servicing but will be included in the next release.
Description
When using
HybridGlobalization
on iOS, theshortdate
format does only contain just either one or twoy
's, which result in only a two-digit year when formatting dates.Reproduction Steps
Set
<HybridGlobalization>true</HybridGlobalization>
in iOS csproj file and format some date with "short date" format (e.g.DateTime.Now.ToString("d")
)Expected behavior
new CultureInfo("de-DE").DateTimeFormat.ShortDatePattern == "dd.MM.yyyy"
new CultureInfo("en-US").DateTimeFormat.ShortDatePattern == "M/d/yyyy"
new CultureInfo("fa-IR").DateTimeFormat.ShortDatePattern == "yyyy/M/d"
Actual behavior
new CultureInfo("de-DE").DateTimeFormat.ShortDatePattern == "dd.MM.yy"
new CultureInfo("en-US").DateTimeFormat.ShortDatePattern == "M/d/yy"
new CultureInfo("fa-IR").DateTimeFormat.ShortDatePattern == "y/M/d"
Regression?
No response
Known Workarounds
No response
Configuration
.NET 8
Other information
A similar problem was reported a while back for Linux here and fixed here. To code is still in the repo:
runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/CalendarData.Icu.cs
Lines 166 to 251 in 3eb8c7f
The text was updated successfully, but these errors were encountered: