|
@@ -6,7 +6,7 @@ import apiObj from '@api/index';
|
|
|
import BlockContext from './problem-context';
|
|
|
import moment from "moment";
|
|
|
import "moment/locale/zh-cn"
|
|
|
-import { disabledDate, getDaysBetween,getValueFromEvent } from '@utils/index'
|
|
|
+import { disabledDate, getDaysBetween, getValueFromEvent } from '@utils/index'
|
|
|
const { post, api, xPost } = apiObj;
|
|
|
const { TextArea } = Input;
|
|
|
function EditBlock(props) {
|
|
@@ -18,9 +18,8 @@ function EditBlock(props) {
|
|
|
const { problemDetail, type } = useContext(BlockContext);
|
|
|
const initialValues = problemDetail;
|
|
|
const onFinish = values => {
|
|
|
- values.startDate = moment(values.startDate).format('YYYY-MM-DD 00:00:00');
|
|
|
- values.endDate = moment(values.endDate).format('YYYY-MM-DD 23:59:59');
|
|
|
- console.log(getDaysBetween(values.startDate, values.endDate));
|
|
|
+ values.startDate = values.startDate ? moment(values.startDate).format('YYYY-MM-DD 00:00:00') : null;
|
|
|
+ values.endDate = values.endDate ? moment(values.endDate).format('YYYY-MM-DD 23:59:59') : null;
|
|
|
if (values.startDate > values.endDate) {
|
|
|
message.warning('开始时间不能大于结束时间');
|
|
|
return
|
|
@@ -227,7 +226,6 @@ function EditBlock(props) {
|
|
|
<Form.Item label="日期" >
|
|
|
<Form.Item name="startDate" className='times'>
|
|
|
<DatePicker
|
|
|
- allowClear={false}
|
|
|
disabledDate={disabledDate}
|
|
|
placeholder="请选择开始日期"
|
|
|
onChange={onStartChange}
|