@@ -177,35 +177,22 @@ return $.widget( "ui.calendar", {
177
177
} ,
178
178
179
179
_setLocale : function ( locale ) {
180
- var globalize = new Globalize ( locale ) ;
181
-
182
- this . _format = function ( date ) {
183
- return globalize . formatDate ( date , { date : "short" } ) ;
184
- } ;
185
-
186
- this . _parse = function ( stringDate ) {
187
- return globalize . parseDate ( stringDate , { date : "short" } ) ;
188
- } ;
189
-
180
+ var globalize = new Globalize ( locale ) ,
181
+ weekdayShortFormatter = globalize . dateFormatter ( { pattern : "EEEEEE" } ) ,
182
+ weekdayNarrowFormatter = globalize . dateFormatter ( { pattern : "EEEEE" } ) ;
183
+ this . _format = globalize . dateFormatter ( { date : "short" } ) ;
184
+ this . _parse = globalize . dateParser ( { date : "short" } ) ;
190
185
this . _calendarDateOptions = {
191
186
firstDay : globalize . cldr . supplemental . weekData . firstDay ( ) ,
192
187
formatWeekdayShort : function ( date ) {
193
188
194
189
// Return the short weekday if its length is < 3. Otherwise, its narrow form.
195
- var shortWeekday = globalize . formatDate ( date , { pattern : "EEEEEE" } ) ;
196
- return shortWeekday . length > 3 ?
197
- globalize . formatDate ( date , { pattern : "EEEEE" } ) :
198
- shortWeekday ;
199
- } ,
200
- formatWeekdayFull : function ( date ) {
201
- return globalize . formatDate ( date , { pattern : "EEEE" } ) ;
190
+ var shortWeekday = weekdayShortFormatter ( date ) ;
191
+ return shortWeekday . length > 3 ? weekdayNarrowFormatter ( date ) : shortWeekday ;
202
192
} ,
203
- formatMonth : function ( date ) {
204
- return globalize . formatDate ( date , { pattern : "MMMM" } ) ;
205
- } ,
206
- formatWeekOfYear : function ( date ) {
207
- return globalize . formatDate ( date , { pattern : "w" } ) ;
208
- } ,
193
+ formatWeekdayFull : globalize . dateFormatter ( { pattern : "EEEE" } ) ,
194
+ formatMonth : globalize . dateFormatter ( { pattern : "MMMM" } ) ,
195
+ formatWeekOfYear : globalize . dateFormatter ( { pattern : "w" } ) ,
209
196
parse : this . _parse
210
197
} ;
211
198
} ,
0 commit comments