mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Calendar: Remove Globalize.cldr.supplemental.weekData dependency
This commit is contained in:
parent
2fe43bbbe2
commit
1566cf1b39
@ -12,7 +12,7 @@ return $.extend( helper, {
|
|||||||
weekdayNarrowFormatter = globalize.dateFormatter( { raw: "EEEEE" } );
|
weekdayNarrowFormatter = globalize.dateFormatter( { raw: "EEEEE" } );
|
||||||
|
|
||||||
return {
|
return {
|
||||||
firstDay: globalize.cldr.supplemental.weekData.firstDay(),
|
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.
|
||||||
|
12
ui/date.js
12
ui/date.js
@ -17,16 +17,6 @@
|
|||||||
}
|
}
|
||||||
}( function( $ ) {
|
}( function( $ ) {
|
||||||
|
|
||||||
var weekdaysRev = {
|
|
||||||
"sun": 0,
|
|
||||||
"mon": 1,
|
|
||||||
"tue": 2,
|
|
||||||
"wed": 3,
|
|
||||||
"thu": 4,
|
|
||||||
"fri": 5,
|
|
||||||
"sat": 6
|
|
||||||
};
|
|
||||||
|
|
||||||
$.ui.date = function( date, attributes ) {
|
$.ui.date = function( date, attributes ) {
|
||||||
if ( !( this instanceof $.ui.date ) ) {
|
if ( !( this instanceof $.ui.date ) ) {
|
||||||
return new $.ui.date( date, attributes );
|
return new $.ui.date( date, attributes );
|
||||||
@ -47,7 +37,7 @@ $.extend( $.ui.date.prototype, {
|
|||||||
|
|
||||||
setAttributes: function( attributes ) {
|
setAttributes: function( attributes ) {
|
||||||
this.attributes = 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.
|
// TODO: Same as the underlying Date object's terminology, but still misleading.
|
||||||
|
@ -201,7 +201,9 @@ return $.widget( "ui.calendar", {
|
|||||||
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: 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 ) {
|
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user