aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/date/helper.js2
-rw-r--r--ui/date.js12
-rw-r--r--ui/widgets/calendar.js4
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.