fix #815
This commit is contained in:
parent
ce75ecdb2b
commit
295081603e
@ -1,5 +1,6 @@
|
||||
import { css } from "@emotion/css";
|
||||
import { DatePicker, Select } from "antd";
|
||||
import moment from "moment";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@ -10,6 +11,7 @@ import { OnField } from "./OnField";
|
||||
export function EndsByField({ value, onChange }) {
|
||||
const { t } = useTranslation();
|
||||
const [type, setType] = useState(typeof value === 'object' && !(value instanceof Date) ? 'field' : 'date');
|
||||
|
||||
return (
|
||||
<fieldset className={css`
|
||||
display: flex;
|
||||
@ -23,12 +25,8 @@ export function EndsByField({ value, onChange }) {
|
||||
<Select.Option value={'date'}>{t('By custom date')}</Select.Option>
|
||||
</Select>
|
||||
{type === 'field'
|
||||
? (
|
||||
<OnField value={value} onChange={onChange} />
|
||||
)
|
||||
: (
|
||||
<DatePicker showTime value={value} onChange={onChange} />
|
||||
)
|
||||
? <OnField value={value} onChange={onChange} />
|
||||
: <DatePicker showTime value={moment(value)} onChange={onChange} />
|
||||
}
|
||||
</fieldset>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user