Sunday, March 11, 2012

Date.localeFormat() error

Check out the docs:http://www.asp.net/ajax/documentation/live/clientreference/Global/JavascriptTypeExtensions/DateTypeExt/DateLocaleFormatFunction.aspx

Is this your issue:

"To format a date object value by using the localeFormat function, set theEnableScriptGlobalization property of theScriptManager control totrue. You must also modify settings in the Web.config file so that theculture attribute of the<globalization> section is set toauto."

-Damien


Yes, I already have those settings in place, and it works great when I use date.localeFormat("d"), the problem arises when I try to use any other format specifier, that's when I get the error.

Hi,

I'm afraid you cann't do this.

Here is relevant code from MS Ajax framework. as you can see "u" is missing from that list

1 Date._expandFormat = function Date$_expandFormat(dtf, format) {
2 if (!format) {
3 format ="F";
4 }
5 if (format.length === 1) {
6 switch (format) {
7 case"d":
8 return dtf.ShortDatePattern;
9 case"D":
10 return dtf.LongDatePattern;
11 case"t":
12 return dtf.ShortTimePattern;
13 case"T":
14 return dtf.LongTimePattern;
15 case"F":
16 return dtf.FullDateTimePattern;
17 case"M":case"m":
18 return dtf.MonthDayPattern;
19 case"s":
20 return dtf.SortableDateTimePattern;
21 case"Y":case"y":
22 return dtf.YearMonthPattern;
23 default:
24 throw Error.format(Sys.Res.formatInvalidString);
25 }
26 }
27 return format;
28 }

But I don't know why it is missing.

Best Regards,

No comments:

Post a Comment