antd - 蚂蚁设计 4 到期日不应小于发行日
问题描述
我是蚂蚁设计的新手。我有一个带有两个日期选择器的表格。发行日期和到期日。我希望能够将到期日期的日期选择器限制为不早于发行日期。到目前为止,这是我的方法。
<Form.Item
label="Issue Date"
name={["userIdentification", "identification_issue_date"]}
rules={[
{
required: true,
message: REQUIRED_ERROR_MESSAGE,
},
]}
>
<DatePicker
disabledDate={(current) =>
current && current > moment()
}
/>
</Form.Item>
<Form.Item
label="Expiry Date"
name={[
"userIdentification",
"identification_expiry_date",
]}
dependencies={[
"userIdentification",
"identification_issue_date",
]}
rules={[
{
required: true,
message: REQUIRED_ERROR_MESSAGE,
},
({ getFieldValue }) => ({
validator(_, value) {
console.log(
"fields value from issue_date",
getFieldValue([
"userIdentification",
"identification_issue_date",
])
);
if (!value && getFieldValue("allocation") === "") {
return Promise.reject(REQUIRED_ERROR_MESSAGE);
}
return Promise.resolve();
},
}),
]}
>
<DatePicker
disabledDate={(current) =>
current && current > moment()
}
/>
</Form.Item>
任何帮助将不胜感激
解决方案
推荐阅读
- regex - 正则表达式:匹配字符集中的字符串,但需要恰好有特定字符的 X 个计数
- javascript - 具有特定变量的唯一 ID,以使用所述变量调用数组中的函数
- python - Python pandas 总结了数据框中的往返行程
- swift - 如何为具有给定前缀的 URL 提供文件?
- javascript - 使用反应路由器时如何在页面上取消渲染元素
- react-native - react原生屏幕的布局如何设计?
- linux - 基础文件更改时如何同步环回设备
- linux - 从失败的脚本执行脚本
- python - ImportError: No module named future 尽管已经安装
- excel - VBA 从一个 Word Doc 复制到另一个 Excel