Calendar: Fix first day of week calculation for non latin locales

This commit is contained in:
Felix Nagel 2015-11-18 17:04:55 +01:00
parent c43149d8a4
commit 9a879d0fdc

View File

@ -196,14 +196,13 @@ return $.widget( "ui.calendar", {
_setLocale: function( locale, dateFormat ) { _setLocale: function( locale, dateFormat ) {
var globalize = new Globalize( locale ), var globalize = new Globalize( locale ),
weekdayShortFormatter = globalize.dateFormatter( { raw: "EEEEEE" } ), weekdayShortFormatter = globalize.dateFormatter( { raw: "EEEEEE" } ),
weekdayNarrowFormatter = globalize.dateFormatter( { raw: "EEEEE" } ); weekdayNarrowFormatter = globalize.dateFormatter( { raw: "EEEEE" } ),
firstDayRaw = globalize.dateFormatter( { raw: "c" } )( new Date( 1970, 0, 3 ) );
this._format = globalize.dateFormatter( dateFormat ); this._format = globalize.dateFormatter( dateFormat );
this._parse = globalize.dateParser( dateFormat ); this._parse = globalize.dateParser( dateFormat );
this._calendarDateOptions = { this._calendarDateOptions = {
firstDay: ( 7 - globalize.parseNumber( firstDayRaw ) ),
// Calculate localized first day of week (reference is first saturday)
firstDay: ( 6 - globalize.dateFormatter( { raw: "c" } )( new Date( 1970, 0, 3 ) ) + 1 ),
formatWeekdayShort: function( date ) { formatWeekdayShort: function( date ) {
// Return the short weekday if its length is < 3. Otherwise, its narrow form. // Return the short weekday if its length is < 3. Otherwise, its narrow form.