Wednesday, March 21, 2012

Localization of the date format in CalendarExtender

Is it possible to change the format of the today date in the footer of the CalendarExtender?

The CalendarExtender localizes the text correctly (i.e. Heute for german) but the date format is always MMM dd, yyyy. I want to change that to dd.MM.yyyy for german.

I tried to change "Heute: {0}" to "Heute: {0: dd.MM.yyyy}" in the ScriptResources.de.resx resource but nothing changed.

Any ideas?

Seehttp://asp.net/AJAX/Control-Toolkit/Live/Calendar/Calendar.aspx andhttp://msdn2.microsoft.com/en-us/library/bz9tc508.aspx.

You should just be able to set the Format property to a standard format (http://msdn2.microsoft.com/en-us/library/bb79761a-ca08-44ee-b142-b06b3e2fc22b.aspx)

-Damien


dwhite:

You should just be able to set the Format property to a standard format

Which Format property do you mean? The Format property on the CalendarExtender is used to format the date that is set in the extended TextBox, not the date that is displayed in the footer of the calendar for today.

Everything is localized correctly (Days, Months, Today-string) but the date format is wrong, it is always in MMM dd, yyyy

Note:
ScriptManager.EnableScriptGlobalization and EnableScriptLocalization are both set to true.


Sorry, I understand you now.

In the CalendarBehavior.js file, line 943:

this._today.appendChild(document.createTextNode(String.format(AjaxControlToolkit.Resources.Calendar_Today, todaysDate.localeFormat("MMMM d, yyyy"))));

Try changing that format and recompile the tool kit. (Also, there may be a fix in one of the later releases on the toolkit, I didn't check).

-Damien


Thanks a lot!

I'll change that as I need it. Lucky me, all cultures I have to support use dd.MM.yyyy.

dwhite:

Also, there may be a fix in one of the later releases on the toolkit, I didn't check

Lets' hope so.

No comments:

Post a Comment