@@ -158,35 +158,22 @@ return $.widget( "ui.calendar", {
158
158
} ,
159
159
160
160
_setLocale : function ( locale ) {
161
- var globalize = new Globalize ( locale ) ;
162
-
163
- this . _format = function ( date ) {
164
- return globalize . formatDate ( date , { date : "short" } ) ;
165
- } ;
166
-
167
- this . _parse = function ( stringDate ) {
168
- return globalize . parseDate ( stringDate , { date : "short" } ) ;
169
- } ;
170
-
161
+ var globalize = new Globalize ( locale ) ,
162
+ weekdayShortFormatter = globalize . dateFormatter ( { pattern : "EEEEEE" } ) ,
163
+ weekdayNarrowFormatter = globalize . dateFormatter ( { pattern : "EEEEE" } ) ;
164
+ this . _format = globalize . dateFormatter ( { date : "short" } ) ;
165
+ this . _parse = globalize . dateParser ( { date : "short" } ) ;
171
166
this . _calendarDateOptions = {
172
167
firstDay : globalize . cldr . supplemental . weekData . firstDay ( ) ,
173
168
formatWeekdayShort : function ( date ) {
174
169
175
170
// Return the short weekday if its length is < 3. Otherwise, its narrow form.
176
- var shortWeekday = globalize . formatDate ( date , { pattern : "EEEEEE" } ) ;
177
- return shortWeekday . length > 3 ?
178
- globalize . formatDate ( date , { pattern : "EEEEE" } ) :
179
- shortWeekday ;
180
- } ,
181
- formatWeekdayFull : function ( date ) {
182
- return globalize . formatDate ( date , { pattern : "EEEE" } ) ;
183
- } ,
184
- formatMonth : function ( date ) {
185
- return globalize . formatDate ( date , { pattern : "MMMM" } ) ;
186
- } ,
187
- formatWeekOfYear : function ( date ) {
188
- return globalize . formatDate ( date , { pattern : "w" } ) ;
171
+ var shortWeekday = weekdayShortFormatter ( date ) ;
172
+ return shortWeekday . length > 3 ? weekdayNarrowFormatter ( date ) : shortWeekday ;
189
173
} ,
174
+ formatWeekdayFull : globalize . dateFormatter ( { pattern : "EEEE" } ) ,
175
+ formatMonth : globalize . dateFormatter ( { pattern : "MMMM" } ) ,
176
+ formatWeekOfYear : globalize . dateFormatter ( { pattern : "w" } ) ,
190
177
parse : this . _parse
191
178
} ;
192
179
} ,
0 commit comments