mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
(fix) Datepicker: Use Globalize 1.0.0
- Use format/parse generators
This commit is contained in:
parent
7f432eddb0
commit
e56c2b4812
@ -177,35 +177,22 @@ return $.widget( "ui.calendar", {
|
||||
},
|
||||
|
||||
_setLocale: function( locale ) {
|
||||
var globalize = new Globalize( locale );
|
||||
|
||||
this._format = function( date ) {
|
||||
return globalize.formatDate( date, { date: "short" } );
|
||||
};
|
||||
|
||||
this._parse = function( stringDate ) {
|
||||
return globalize.parseDate( stringDate, { date: "short" } );
|
||||
};
|
||||
|
||||
var globalize = new Globalize( locale ),
|
||||
weekdayShortFormatter = globalize.dateFormatter({ pattern: "EEEEEE" }),
|
||||
weekdayNarrowFormatter = globalize.dateFormatter({ pattern: "EEEEE" });
|
||||
this._format = globalize.dateFormatter({ date: "short" });
|
||||
this._parse = globalize.dateParser({ date: "short" });
|
||||
this._calendarDateOptions = {
|
||||
firstDay: globalize.cldr.supplemental.weekData.firstDay(),
|
||||
formatWeekdayShort: function( date ) {
|
||||
|
||||
// Return the short weekday if its length is < 3. Otherwise, its narrow form.
|
||||
var shortWeekday = globalize.formatDate( date, { pattern: "EEEEEE" } );
|
||||
return shortWeekday.length > 3 ?
|
||||
globalize.formatDate( date, { pattern: "EEEEE" } ) :
|
||||
shortWeekday;
|
||||
},
|
||||
formatWeekdayFull: function( date ) {
|
||||
return globalize.formatDate( date, { pattern: "EEEE" } );
|
||||
},
|
||||
formatMonth: function( date ) {
|
||||
return globalize.formatDate( date, { pattern: "MMMM" } );
|
||||
},
|
||||
formatWeekOfYear: function( date ) {
|
||||
return globalize.formatDate( date, { pattern: "w" } );
|
||||
var shortWeekday = weekdayShortFormatter( date );
|
||||
return shortWeekday.length > 3 ? weekdayNarrowFormatter( date ) : shortWeekday;
|
||||
},
|
||||
formatWeekdayFull: globalize.dateFormatter({ pattern: "EEEE" }),
|
||||
formatMonth: globalize.dateFormatter({ pattern: "MMMM" }),
|
||||
formatWeekOfYear: globalize.dateFormatter({ pattern: "w" }),
|
||||
parse: this._parse
|
||||
};
|
||||
},
|
||||
|
@ -283,18 +283,9 @@ var widget = $.widget( "ui.datepicker", {
|
||||
|
||||
_setLocale: function( locale ) {
|
||||
var globalize = new Globalize( locale );
|
||||
|
||||
this._format = function( date ) {
|
||||
return globalize.formatDate( date, { date: "short" } );
|
||||
};
|
||||
|
||||
this._parse = function( stringDate ) {
|
||||
return globalize.parseDate( stringDate, { date: "short" } );
|
||||
};
|
||||
|
||||
this._parseYMD = function( stringDate ) {
|
||||
return globalize.parseDate( stringDate, { pattern: "yyyy-MM-dd" } );
|
||||
};
|
||||
this._format = globalize.dateFormatter({ date: "short" });
|
||||
this._parse = globalize.dateParser({ date: "short" });
|
||||
this._parseYMD = globalize.dateParser({ pattern: "yyyy-MM-dd" });
|
||||
},
|
||||
|
||||
_buildPosition: function() {
|
||||
|
Loading…
Reference in New Issue
Block a user