我使用了datepickers
以下是加载其中一个的代码
export function load_datepickers_inline():void {
const search_legs_0_datepicker = $("#search_legs_0_datepicker");
const leg_0_datepicker = $("#search_legs_0_datepicker").datepicker({
language: gon.locale,
classes: 'inline-picker',
altField: '#search_legs_0_date',
defaultDate: new Date(search_legs_0_datepicker.attr("data-defaultDate")),
minDate: new Date(search_legs_0_datepicker.attr('data-mindate')),
maxDate: new Date(search_legs_0_datepicker.attr('data-maxdate')),
altFormat: 'yy-mm-dd',
onSelect: (dateText, inst) => {
const date = new Date(dateText);
if (!leg_0_datepicker) { return false; }
leg_1_datepicker.datepicker("option", "minDate", date);
if ($("#search_legs_0_hotel_date").length > 0) {
$('#search_legs_0_hotel_date').datepicker().data('datepicker').update('minDate', date);
$('#search_legs_0_hotel_date').datepicker().data('datepicker').datepicker("setDate", date);
$('#search_legs_1_hotel_date').datepicker().data('datepicker').update('minDate', date);
}
}
})
效果很好,并向我展示了datepicker,就像这样
但是我需要像这样格式化它的标题
四月, 2018
我怎么做?