gpt4 book ai didi

javascript - 如何将 Kalendae 的日期设置为 17 年前?

转载 作者:行者123 更新时间:2023-11-28 08:27:26 39 4
gpt4 key购买 nike

我正在使用https://github.com/ChiperSoft/Kalendae这是一个基于JS的日期选择器。

我想知道是否可以将 Kalendae 当前月份/日期设置为 17 年前 + 从那时起屏蔽 future 。

我现在的 Kalendae 是这样制作的:

(:class => "auto-kal", "data-kal" => "format:'DD/MM/YYYY',weekStart:1")

亲切的问候

最佳答案

我认为这应该是您正在寻找的:

var my_date = moment().subtract('years', 17); // Calculate calendar date = current - 17 years
new Kalendae(document.body, {
format: 'D/M/YYYY', // Set calendar date format
selected: my_date.format('D/M/YYYY'), // Set calendar date with same format as calendar expects it
direction: 'past',
blackout: function (date) {
return date > my_date; // Blackout calendar days that are greater than my_date
}
});

Fiddle

解决方案使用 moment.js用于日期操作。

关于javascript - 如何将 Kalendae 的日期设置为 17 年前?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22246909/

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