javascript - 禁用未来日期引导 vue datepicker
问题描述
我正在使用 bootstrap-vue 插件。我想禁用 bootstrap-vue datepicker 的未来日期。
这是我的代码:
<b-form-datepicker :date-disabled-fn="disabledDates" v-model="form.date_of_birth" placeholder="Select Date"/>
在 Js 部分:
methods: {
dateDisabled(ymd, date) {
// Disable weekends (Sunday = `0`, Saturday = `6`) and
// disable days that fall on the 13th of the month
const weekday = date.getDay()
const day = date.getDate()
// Return `true` if the date should be disabled
return weekday === 0 || weekday === 6 || day === 13
}
}
它正在禁用周末和每月 13 日。但我想禁用所有未来的日期。
根据他们的文件:
The function should either return true if the date cannot be selected (disabled), or false if the date can be selected (enabled). Note that the function cannot be asynchronous, and should return a value as quickly as possible.
我无法制定返回未来日期的逻辑。我怎样才能做到这一点?
解决方案
推荐阅读
- kubernetes - Kubectl 使用命令获取集群状态
- java - 在 TextView 中保存数据
- python - 如何在 spark 中使用 python 加载多个 mongodb 集合
- javascript - 控制何时在 HighCharts 中使用升压模式?
- zigbee - 哪种是满足我以下要求的最佳 zigbee 模式?
- sql - 使用参数的 SQL 日期查询 - Delphi
- android - 在 kotlin 中使用 SimpleXML 序列化改造 xml 响应
- django - 未提供身份验证凭据。Django Rest Framework/JWT 和 React 原生 iOS
- django - Django 自定义 cache_page 装饰器在之后唯一的第一次运行时返回错误,没关系
- python - 将击键发送到特定窗口(在后台),但同时执行其他操作