我在Meteor,AutoForm和Simple-schema上输入日期验证有问题.
如果启用Chrome自动日期选择器,则验证无法识别日期格式或类型,如架构(类型:日期)或输入(类型="日期")"08/19/2014"
如果它关闭了Chrome日期选择器,当我使用bootstrap3-datepicker并且将js设置格式设置为"2014-08-19"时就像他们写的一样,我有相同的日期验证问题.
例:
.js文件
schema: {
'orderDate': {
type: Date,
label: "OrderDate",
optional: true
}
Run Code Online (Sandbox Code Playgroud)
html的
{{> afQuickField name ="orderDate"type ="date"}}
或者使用{{#autoForm}}
<div class="form-group {{#if afFieldIsInvalid name='orderDate'}}has-error{{/if}}">
{{> afFieldLabel name='orderDate'}}
<span class="help-block">*Requered</span>
{{> afFieldInput name='orderDate' id="OrderDate"}}
{{#if afFieldIsInvalid name='orderDate'}}
<span class="help-block">{{{afFieldMessage name='orderDate'}}}</span>
{{/if}}
</div>
Run Code Online (Sandbox Code Playgroud)
或者使用bootstrap3-datepicker
<input type="date" id="orderPickerDate" class="form-control" />
Run Code Online (Sandbox Code Playgroud)
谢谢.