Opened 8 years ago

Closed 4 years ago

#6682 closed feature (fixed)

Datepicker: No explicit en or en-US regional settings for datepicker

Reported by: cim Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.datepicker Version: 1.8.6
Keywords: Cc:
Blocked by: Blocking:

Description

Although datepicker defaults to US English regional settings there is no explicit regional setting for en-US, or for that matter for en. This makes it a little more fiddly if you are trying to write an application that sets the datepicker regional setting according to the browser's accept-language settings. If the browser language is set to en or en-US then you have to do something special.

It would be nice if there were explicit regional settings for en and en-US and I suggest the following:

/* English (defaults to US) initialisation for the jQuery UI date picker plugin. */
jQuery(function($){
	$.datepicker.regional['en'] = {
		closeText: 'Done',
		prevText: 'Prev',
		nextText: 'Next',
		currentText: 'Today',
		monthNames: ['January','February','March','April','May','June',
		'July','August','September','October','November','December'],
		monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
		'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
		dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
		dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
		dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
		weekHeader: 'Wk',
		dateFormat: 'mm/dd/yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['en']);
});
/* US English initialisation for the jQuery UI date picker plugin. */
jQuery(function($){
	$.datepicker.regional['en-US'] = {
		closeText: 'Done',
		prevText: 'Prev',
		nextText: 'Next',
		currentText: 'Today',
		monthNames: ['January','February','March','April','May','June',
		'July','August','September','October','November','December'],
		monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
		'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
		dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
		dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
		dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
		weekHeader: 'Wk',
		dateFormat: 'mm/dd/yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['en-US']);
});

Campbell

Change History (6)

comment:1 Changed 8 years ago by cim

See also ticket #6828

comment:2 Changed 6 years ago by markoh

Will this ever get addressed/included in JQuery UI Datepicker? We too really need this. Now it's down to if..else.. conditions or manually including Campbell's code in our localization JS files.

comment:3 Changed 6 years ago by Scott González

Type: enhancementfeature

comment:4 Changed 6 years ago by Scott González

Milestone: 1.9.01.11.0

comment:5 Changed 6 years ago by petersendidit

Status: newopen
Summary: No explicit en or en-US regional settings for datepickerDatepicker: No explicit en or en-US regional settings for datepicker

comment:6 Changed 4 years ago by Scott González

Resolution: fixed
Status: openclosed

Datepicker: Define en and en-US locales based on defaults

Fixes #6682 Closes gh-1269

Changeset: 450d75f912f4161c475f18f9eeb7efd307c02eae

Note: See TracTickets for help on using tickets.