前言:django当中设定某个字段为日期类型,关键在使用#id_字段名
//只显示年份
function dataTaskYearData() {
$('#id_task_year').datepicker({
format: 'yyyy',
language: "zh-CN",
autoclose: true,
startView: 2,
minViewMode: 2,
maxViewMode: 2
});
}
//只显示月份
function dataTaskMonthData() {
$('#id_task_month').datepicker({
format: 'mm',
language: "zh-CN",
autoclose: true,
startView: 1,
minViewMode: 1,
maxViewMode: 2
});
}
//显示日
$('.datetimepicker3').datepicker({
//language: 'zh-CN', //语言
format: 'yyyy-mm',
language: "zh-CN",
autoclose:true,
startView: 0,
minViewMode: 0,
maxViewMode: 0
});
//显示年月
$('.datetimepicker2').datepicker({
//language: 'zh-CN', //语言
format: 'yyyy-mm',
language: "zh-CN",
autoclose:true,
startView: 2,
minViewMode: 1,
maxViewMode: 2
});