Commit 6aca3d30 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复时间不可以选择过去时间的问题

parent 7035053e
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-07-02 17:53:48 * @Date: 2021-07-02 17:53:48
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-09-24 11:52:11 * @LastEditTime: 2021-11-15 14:22:03
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -39,8 +39,8 @@ const schema: ISchema = { ...@@ -39,8 +39,8 @@ const schema: ISchema = {
width: '100%', width: '100%',
}, },
disabledDate: (current) => current && current < moment().startOf('day'), disabledDate: (current) => current && current < moment().startOf('day'),
disabledTime: (_, type) => { disabledTime: (current, type) => {
if (type === 'start') { if (type === 'start' && moment().isSame(current, 'day')) {
return { return {
disabledHours: () => range(0, 24).splice(0, moment().get('hour')), disabledHours: () => range(0, 24).splice(0, moment().get('hour')),
disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')), disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-06-24 14:05:57 * @Date: 2021-06-24 14:05:57
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-09-26 15:09:11 * @LastEditTime: 2021-11-15 14:20:08
* @Description: * @Description:
*/ */
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
...@@ -105,8 +105,8 @@ const schema: ISchema = { ...@@ -105,8 +105,8 @@ const schema: ISchema = {
placeholder: ['领(发)劵起始时间', '领(发)劵截止时间'], placeholder: ['领(发)劵起始时间', '领(发)劵截止时间'],
showTime: true, showTime: true,
disabledDate: (current) => current && current < moment().startOf('day'), disabledDate: (current) => current && current < moment().startOf('day'),
disabledTime: (_, type) => { disabledTime: (current, type) => {
if (type === 'start') { if (type === 'start' && moment().isSame(current, 'day')) {
return { return {
disabledHours: () => range(0, 24).splice(0, moment().get('hour')), disabledHours: () => range(0, 24).splice(0, moment().get('hour')),
disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')), disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')),
...@@ -302,8 +302,8 @@ const schema: ISchema = { ...@@ -302,8 +302,8 @@ const schema: ISchema = {
placeholder: ['劵有效期起始时间', '劵有效期截止时间'], placeholder: ['劵有效期起始时间', '劵有效期截止时间'],
showTime: true, showTime: true,
disabledDate: (current) => current && current < moment().startOf('day'), disabledDate: (current) => current && current < moment().startOf('day'),
disabledTime: (_, type) => { disabledTime: (current, type) => {
if (type === 'start') { if (type === 'start' && moment().isSame(current, 'day')) {
return { return {
disabledHours: () => range(0, 24).splice(0, moment().get('hour')), disabledHours: () => range(0, 24).splice(0, moment().get('hour')),
disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')), disabledMinutes: () => range(0, 60).splice(0, moment().get('minute')),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment