Calendar: Remove Globalize.cldr.supplemental.weekData dependency

This commit is contained in:
Felix Nagel 2015-11-16 22:30:51 +01:00
parent 2fe43bbbe2
commit 1566cf1b39
3 changed files with 5 additions and 13 deletions

View File

@ -12,7 +12,7 @@ return $.extend( helper, {
weekdayNarrowFormatter = globalize.dateFormatter( { raw: "EEEEE" } );
return {
firstDay: globalize.cldr.supplemental.weekData.firstDay(),
firstDay: ( 6 - globalize.dateFormatter( { raw: "c" } )( new Date( 1970, 0, 3 ) ) + 1 ),
formatWeekdayShort: function( date ) {
// Return the short weekday if its length is < 3. Otherwise, its narrow form.

View File

@ -17,16 +17,6 @@
}
}( function( $ ) {
var weekdaysRev = {
"sun": 0,
"mon": 1,
"tue": 2,
"wed": 3,
"thu": 4,
"fri": 5,
"sat": 6
};
$.ui.date = function( date, attributes ) {
if ( !( this instanceof $.ui.date ) ) {
return new $.ui.date( date, attributes );
@ -47,7 +37,7 @@ $.extend( $.ui.date.prototype, {
setAttributes: function( attributes ) {
this.attributes = attributes;
this.firstDay = weekdaysRev[ this.attributes.firstDay ];
this.firstDay = this.attributes.firstDay;
},
// TODO: Same as the underlying Date object's terminology, but still misleading.

View File

@ -201,7 +201,9 @@ return $.widget( "ui.calendar", {
this._format = globalize.dateFormatter( dateFormat );
this._parse = globalize.dateParser( dateFormat );
this._calendarDateOptions = {
firstDay: globalize.cldr.supplemental.weekData.firstDay(),
// 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 ) {
// Return the short weekday if its length is < 3. Otherwise, its narrow form.