8 Apr 2011

Localization of jQuery UI DatePicker with ASP.NET

Hello folks! Do you want to make your jQuery DatePicker play nicely with your ASP.NET localization settings?

When you set up your DatePicker inputs on the page, try this:


$('.DatePicker').datepicker({
dayNamesMin: ['<%= string.Join("', '", System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortestDayNames) %>'],
monthNames: ['<%= string.Join("', '", System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthNames) %>'],
monthNamesShort: ['<%= string.Join("', '", System.Globalization.DateTimeFormatInfo.CurrentInfo.AbbreviatedMonthNames) %>']
});

0 comments:

Post a Comment