jQuery UI datepicker:如何将下拉列表中的月份名称从短名称更改为长名称? [英] jQuery UI datepicker: How to change the month names in the drop-down from short to long names?
本文介绍了jQuery UI datepicker:如何将下拉列表中的月份名称从短名称更改为长名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的属性是:
我的属性是:我需要将名称从短名称更改为长名称 p> $。datepicker.regional ['de'] = {
prevText:'< zur& uuml; ck',
nextText:'vor>',
monthNames:['Januar','Februar','M& auml; rz','April','Mai','Juni ',
'Juli','August','September','Oktober','November','Dezember'],
monthNamesShort:['Jan','Feb','M& auml ; r','Apr','Mai','Jun',
'Jul','Aug','Sep','Okt','Nov','Dez'],
dayNames :['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
dayNamesShort:['So','Mo','Di' 'Mi','Do','Fr','Sa'],
dayNamesMin:['So','Mo','Di','Mi','Do ','Fr','Sa'],
weekHeader:'Wo',
dateFormat:'dd.mm.yy',
firstDay:1,
changeMonth:true ,
changeYear:true,
yearRange:-0:+2,
isRTL:false,
showMonthAfterYear:false,
minDate:0
};
$ .datepicker.setDefaults($。datepicker.regional ['de']);
var dates = $(#von,#bis)。datepicker({
showOn:button,
buttonImage:calendar.png,
buttonImageOnly:true ,
buttonText:'Datum w\\\ählen',
onSelect:function(selectedDate){
var option = this.id ==#von?minDate:maxDate ,
instance = $(this).data(datepicker),
date = $ .datepicker.parseDate(
instance.settings.dateFormat ||
$ .datepicker。 _defaults.dateFormat,
selectedDate,instance.settings);
dates.not(this).datepicker(option,option,date);
}
});
当时日历只显示短的月份名称,如Apr而不是April下拉列表。
也许我用一些代码覆盖了默认的长名称?
请帮忙。
解决方案
使用属性 monthNamesShort
,并将其命名为所需的名称。
在我的情况下,我想在月份下拉列表中显示月份名称,在葡萄牙语中:
monthNamesShort:[Janeiro,Fevereiro,Março,Abril,
Maio,Junho,Julho,Agosto ,Setembro,
Outubro,Novembro,Dezembro]
I need to change the month names from short names to long names in my jQuery UI datepicker.
My properties are:
$.datepicker.regional['de'] = {
prevText: '<zurück',
nextText: 'vor>',
monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni',
'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
monthNamesShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun',
'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
weekHeader: 'Wo',
dateFormat: 'dd.mm.yy',
firstDay: 1,
changeMonth: true,
changeYear: true,
yearRange: "-0:+2",
isRTL: false,
showMonthAfterYear: false,
minDate: 0
};
$.datepicker.setDefaults($.datepicker.regional['de']);
var dates = $("#von, #bis").datepicker({
showOn: "button",
buttonImage: "calendar.png",
buttonImageOnly: true,
buttonText: 'Datum w\u00E4hlen',
onSelect: function (selectedDate) {
var option = this.id == "#von" ? "minDate" : "maxDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings);
dates.not(this).datepicker("option", option, date);
}
});
At the moment the calendar only shows short month names like "Apr" instead of "April" in the dropdown list.
Maybe I am overwriting the default long names with some piece of code?
Please help.
解决方案
Use the property monthNamesShort
and attribute it the names you want.
In my case, I wanted to show, in the month drop-down, the month long name, in portuguese:
monthNamesShort: [ "Janeiro", "Fevereiro", "Março", "Abril",
"Maio", "Junho", "Julho", "Agosto", "Setembro",
"Outubro", "Novembro", "Dezembro" ]
这篇关于jQuery UI datepicker:如何将下拉列表中的月份名称从短名称更改为长名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文