Greetings.
Working with html date input control.
使用html日期输入控件。
input type="date" max="2014-13-11"
输入类型=“日期”max =“2014-13-11”
In chrome its recognizing 'max'attribute hence restricting and disabling all future date
在chrome中它识别'max'属性因此限制和禁用所有未来日期
But, the same is not working in iPad/iphone. Instead its allowing to select future date in iPad.
但是,同样不适用于iPad / iphone。而是允许在iPad中选择未来的日期。
Googled and came to know that ipad is not yet supporting Max attribute of date control.
谷歌搜索并了解到ipad尚未支持日期控制的Max属性。
Is there any work around? or any points / direction will be really help for me.
有什么工作吗?或任何点/方向对我来说真的很有帮助。
Many thanks. Karthik
非常感谢。 KARTHIK
1 个解决方案
#1
0
Safari on iOS does not support the attributes max
and min
for input="date"
.
iOS上的Safari不支持input =“date”的属性max和min。
You could use a JavaScript datapicker like Pikaday for this. See demo below:
您可以使用像Pikaday这样的JavaScript数据标签。见下面的演示:
var picker = new Pikaday({
field: document.getElementById('datepicker'),
firstDay: 1,
minDate: new Date(), // minimum/earliest date
maxDate: new Date(2017, 12, 31), // maximum/latest date
yearRange: [2000, 2017],
// demo only
position: 'top left',
reposition: false
});
<!-- Pikaday Library -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.5.1/css/pikaday.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.5.1/pikaday.min.js"></script>
<!-- Datepicker Input -->
<label for="datepicker">Date</label>
<input type="text" id="datepicker">
For more info, please refer to the documentation on GitHub.
有关详细信息,请参阅GitHub上的文档。
#1
0
Safari on iOS does not support the attributes max
and min
for input="date"
.
iOS上的Safari不支持input =“date”的属性max和min。
You could use a JavaScript datapicker like Pikaday for this. See demo below:
您可以使用像Pikaday这样的JavaScript数据标签。见下面的演示:
var picker = new Pikaday({
field: document.getElementById('datepicker'),
firstDay: 1,
minDate: new Date(), // minimum/earliest date
maxDate: new Date(2017, 12, 31), // maximum/latest date
yearRange: [2000, 2017],
// demo only
position: 'top left',
reposition: false
});
<!-- Pikaday Library -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.5.1/css/pikaday.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.5.1/pikaday.min.js"></script>
<!-- Datepicker Input -->
<label for="datepicker">Date</label>
<input type="text" id="datepicker">
For more info, please refer to the documentation on GitHub.
有关详细信息,请参阅GitHub上的文档。