Skip to main content

Search and Top Navigation

#6682 closed feature (fixed)

Opened November 22, 2010 02:27PM UTC

Closed June 16, 2014 02:43PM UTC

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

Attachments (0)
Change History (6)

Changed January 11, 2011 09:37AM UTC by cim comment:1

See also ticket #6828

Changed June 17, 2012 10:29AM UTC by markoh comment:2

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.

Changed June 26, 2012 01:22AM UTC by scottgonzalez comment:3

type: enhancementfeature

Changed October 11, 2012 02:43PM UTC by scottgonzalez comment:4

milestone: 1.9.01.11.0

Changed October 16, 2012 09:18PM UTC by petersendidit comment:5

status: newopen
summary: No explicit en or en-US regional settings for datepickerDatepicker: No explicit en or en-US regional settings for datepicker

Changed June 16, 2014 02:43PM UTC by Scott González comment:6

resolution: → fixed
status: openclosed

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

Fixes #6682

Closes gh-1269

Changeset: 450d75f912f4161c475f18f9eeb7efd307c02eae