diff options
author | Felix Nagel <info@felixnagel.com> | 2015-11-16 22:30:51 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2015-11-16 22:54:44 +0100 |
commit | 1566cf1b3946070964d18b1b5ad1769b3913f560 (patch) | |
tree | 37ccf6d66946aa6cb52c1b4b372787c5514d0c36 | |
parent | 2fe43bbbe20ba59dbbbef1effd9f59ac64cb15a7 (diff) | |
download | jquery-ui-1566cf1b3946070964d18b1b5ad1769b3913f560.tar.gz jquery-ui-1566cf1b3946070964d18b1b5ad1769b3913f560.zip |
Calendar: Remove Globalize.cldr.supplemental.weekData dependency
-rw-r--r-- | tests/unit/date/helper.js | 2 | ||||
-rw-r--r-- | ui/date.js | 12 | ||||
-rw-r--r-- | ui/widgets/calendar.js | 4 |
3 files changed, 5 insertions, 13 deletions
diff --git a/tests/unit/date/helper.js b/tests/unit/date/helper.js index fa9c9cf66..3c8056e6a 100644 --- a/tests/unit/date/helper.js +++ b/tests/unit/date/helper.js @@ -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. diff --git a/ui/date.js b/ui/date.js index 2d94f1083..41effff2b 100644 --- a/ui/date.js +++ b/ui/date.js @@ -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. diff --git a/ui/widgets/calendar.js b/ui/widgets/calendar.js index cb777ef01..25bb79be4 100644 --- a/ui/widgets/calendar.js +++ b/ui/widgets/calendar.js @@ -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. |