![](/img/trans.png)
[英]Angular 2 Ionic 2 - How to set max or min date to today for date input?
[英]how to set max & min in Input type date on iOS
如何在輸入類型日期中設置最小和最大日期
我試試
<input name="DOB" id="DOB" class="enterAddressFormField" placeholder="Date of birthday " size="50" maxlength="60" pattern="yyyy-MM-dd" type="text" onfocus="this.type='date';this.max=='1979-12-31';this.min=='1910-01-01';this.setAttribute('onfocus','');this.blur();this.focus();">
和
<input name="DOB" id="DOB" class="enterAddressFormField" placeholder="Date of birthday " size="50" maxlength="60" pattern="yyyy-MM-dd" min="1910-01-02" max="1979-12-31" type="text" onfocus="this.type='date';this.setAttribute('onfocus','');this.blur();this.focus();">
你應該使用 datepicker js
$('#datepicker').datepicker({
dateFormat: "yy-mm-dd",
maxDate:'+1m +10d',
minDate: -10
});
在這里檢查一下
https://makitweb.com/set-minimum-maximum-date-jquery-ui-datepicker/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.