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