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 ) {
|
_setLocale: function( locale ) {
|
||||||
var globalize = new Globalize( locale );
|
var globalize = new Globalize( locale ),
|
||||||
|
weekdayShortFormatter = globalize.dateFormatter({ pattern: "EEEEEE" }),
|
||||||
this._format = function( date ) {
|
weekdayNarrowFormatter = globalize.dateFormatter({ pattern: "EEEEE" });
|
||||||
return globalize.formatDate( date, { date: "short" } );
|
this._format = globalize.dateFormatter({ date: "short" });
|
||||||
};
|
this._parse = globalize.dateParser({ date: "short" });
|
||||||
|
|
||||||
this._parse = function( stringDate ) {
|
|
||||||
return globalize.parseDate( stringDate, { date: "short" } );
|
|
||||||
};
|
|
||||||
|
|
||||||
this._calendarDateOptions = {
|
this._calendarDateOptions = {
|
||||||
firstDay: globalize.cldr.supplemental.weekData.firstDay(),
|
firstDay: globalize.cldr.supplemental.weekData.firstDay(),
|
||||||
formatWeekdayShort: function( date ) {
|
formatWeekdayShort: function( date ) {
|
||||||
|
|
||||||
// Return the short weekday if its length is < 3. Otherwise, its narrow form.
|
// Return the short weekday if its length is < 3. Otherwise, its narrow form.
|
||||||
var shortWeekday = globalize.formatDate( date, { pattern: "EEEEEE" } );
|
var shortWeekday = weekdayShortFormatter( date );
|
||||||
return shortWeekday.length > 3 ?
|
return shortWeekday.length > 3 ? weekdayNarrowFormatter( date ) : shortWeekday;
|
||||||
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" } );
|
|
||||||
},
|
},
|
||||||
|
formatWeekdayFull: globalize.dateFormatter({ pattern: "EEEE" }),
|
||||||
|
formatMonth: globalize.dateFormatter({ pattern: "MMMM" }),
|
||||||
|
formatWeekOfYear: globalize.dateFormatter({ pattern: "w" }),
|
||||||
parse: this._parse
|
parse: this._parse
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -283,18 +283,9 @@ var widget = $.widget( "ui.datepicker", {
|
|||||||
|
|
||||||
_setLocale: function( locale ) {
|
_setLocale: function( locale ) {
|
||||||
var globalize = new Globalize( locale );
|
var globalize = new Globalize( locale );
|
||||||
|
this._format = globalize.dateFormatter({ date: "short" });
|
||||||
this._format = function( date ) {
|
this._parse = globalize.dateParser({ date: "short" });
|
||||||
return globalize.formatDate( date, { date: "short" } );
|
this._parseYMD = globalize.dateParser({ pattern: "yyyy-MM-dd" });
|
||||||
};
|
|
||||||
|
|
||||||
this._parse = function( stringDate ) {
|
|
||||||
return globalize.parseDate( stringDate, { date: "short" } );
|
|
||||||
};
|
|
||||||
|
|
||||||
this._parseYMD = function( stringDate ) {
|
|
||||||
return globalize.parseDate( stringDate, { pattern: "yyyy-MM-dd" } );
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildPosition: function() {
|
_buildPosition: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user