gpt4 book ai didi

javascript - Amsul DateTimePicker - 如何取消选择事件日期?

转载 作者:太空宇宙 更新时间:2023-11-04 06:15:19 24 4
gpt4 key购买 nike

我正在使用 amsul 日期时间选择器 ( https://amsul.ca/pickadate.js/date/ ),如果您在预览中看到今天的日期以绿色突出显示。现在,如果您将日历移到下个月或上个月。每个月的今天也会突出显示。

我如何取消突出显示除今天以外的任何其他日期?

$('.datepicker').pickadate()
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://hateable-tests.000webhostapp.com/classic.css" rel="stylesheet">
<link href="https://hateable-tests.000webhostapp.com/classic.date.css" rel="stylesheet">
<link href="https://hateable-tests.000webhostapp.com/classic.time.css" rel="stylesheet">
<script src="https://hateable-tests.000webhostapp.com/picker.js"></script>
<script src="https://hateable-tests.000webhostapp.com/legacy.js"></script>
<script src="https://hateable-tests.000webhostapp.com/picker.date.js"></script>
<script src="https://hateable-tests.000webhostapp.com/picker.time.js"></script>
<input type="text" class="datepicker">

最佳答案

我相信这就是答案:https://github.com/amsul/pickadate.js/issues/805

ilnee commented on 2 Oct 2016

I ran into this issue as well. As a workaround, I remove thepicker__day--highlighted class from every div with that class thatdoesn't have today's timestamp as data-pick value:

var now = new Date();
var timestamp = new Date(now.getFullYear(), now.getMonth(), now.getDate()) / 1;

$('.datepicker').pickadate({
onRender: function() {
$('div.picker__day--highlighted').each(function(index, value) {
if ($(this).data('pick') !== timestamp) {
$(this).removeClass('picker__day--highlighted');
}
});
}
});

关于javascript - Amsul DateTimePicker - 如何取消选择事件日期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56029030/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com