I have the following code:
var thursday = new CultureInfo("es-ES").DateTimeFormat.AbbreviatedDayNames[4];
which returns "ju.", as expected.
I have just inherited some pretty old code, which has test code that expects the value to be "jue"...
I was wondering - has this ever changed in the .Net framework?
EDIT 1 - To extend:
I am using .Net 4.5... I have a recently built machine with Visual Studio 2013 and nothing out of the ordinary installed.
var format = new CultureInfo("es-ES").DateTimeFormat;
Console.WriteLine("AbbreviatedDayNames:");
foreach (var name in format.AbbreviatedDayNames)
{
Console.WriteLine(name);
}
Console.WriteLine("ShortestDayNames:");
foreach (var name in format.ShortestDayNames)
{
Console.WriteLine(name);
}
Outputs:
AbbreviatedDayNames:
do.
lu.
ma.
mi.
ju.
vi.
sá.
ShortestDayNames:
D
L
M
X
J
V
S
Edit 2 - My machine is UK english, although I don't see why that would matter if I specify the culture as "es-ES"?
Edit 3 - Weirdly:
https://dotnetfiddle.net/ - returns ju.
http://www.compileonline.com/compile_csharp_online.php - returns jue
The CalendarData object makes a C# to C++ transition when fetching the calendar data, on its way to acquiring calendar information from the OS.
OS version and settings differences for the values in the array would be the cause of this, not an actual .NetFX change.
You can reference the C# framework code at http://www.dotnetframework.org/default.aspx/4@0/4@0/DEVDIV_TFS/Dev10/Releases/RTMRel/ndp/clr/src/BCL/System/Globalization/CalendarData@cs/1305376/CalendarData@cs and note the managed-to-native included method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With