Twitter bootstrap 需要在引导程序中对formate进行日期验证;DD/Mon/YYYY“;
我的日期格式是“DD/Mon/YYYY”。我正在将从日期选择器选择的日期更改为此格式。在提交表格时,我需要验证日期。我试过了Twitter bootstrap 需要在引导程序中对formate进行日期验证;DD/Mon/YYYY“;,twitter-bootstrap,validation,date,Twitter Bootstrap,Validation,Date,我的日期格式是“DD/Mon/YYYY”。我正在将从日期选择器选择的日期更改为此格式。在提交表格时,我需要验证日期。我试过了 dob : { container : 'popover', validators : { notEmpty : { message : 'DOB cannot be empty' }, d
dob : {
container : 'popover',
validators : {
notEmpty : {
message : 'DOB cannot be empty'
},
date: {
format: 'DD/Mon/YYYY',
separator:'/',
message: 'The value is not a valid date'
}
}
}
但它不起作用。谁能告诉我要指定的确切格式是什么吗?我没有使用相同的格式,但请尝试以下方法:
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'dd/mm/yyyy');
因此,尝试dd/mm/yyyy
而不是dd/Mon/yyyy
因为日期选择器使用此格式:
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
val = parseInt(parts[i], 10)||1;
switch(format.parts[i]) {
case 'dd':
case 'd':
day = val;
date.setDate(val);
break;
case 'mm':
case 'm':
month = val - 1;
date.setMonth(val - 1);
break;
case 'yy':
year = 2000 + val;
date.setFullYear(2000 + val);
break;
case 'yyyy':
year = val;
date.setFullYear(val);
break;
}
}
for(var i=0,cnt=format.parts.length;i
我希望日期看起来像此格式的“02/Jun/1993”。我已经试过你早些时候说的话了。它没有按我需要的那样工作。