bootstrap-datetimepicker选择年和月

时间:2022-09-26 11:48:00
$("#year").datetimepicker({
    format: 'yyyy',
    autoclose:true,
    startView:4,
    minView:4,
    maxView:4,
    initialDate:new Date(),
    language:'zh-CN'
}).on('changeDate', function(){
    var date = $("#year").val();
    getSaleCount(date);
}); 
$("#month").datetimepicker({
    format: 'mm',
    autoclose:true,
    startView:3,
    minView:3,
    maxView:3,
    initialDate:new Date(),
    language:'zh-CN'
}).on('changeDate', function(){
    var year = $("#year").val();
    var month = $("#month").val();
    var date = year + month;
    getSaleCount(date);
});