mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 20:54:14 +00:00
33 lines
722 B
TypeScript
33 lines
722 B
TypeScript
|
|
import { DatePicker } from 'antd';
|
||
|
|
import type { Dayjs } from 'dayjs';
|
||
|
|
|
||
|
|
interface DateTimePickerProps {
|
||
|
|
value: Dayjs | null;
|
||
|
|
onChange: (next: Dayjs | null) => void;
|
||
|
|
showTime?: boolean;
|
||
|
|
format?: string;
|
||
|
|
placeholder?: string;
|
||
|
|
disabled?: boolean;
|
||
|
|
}
|
||
|
|
|
||
|
|
export default function DateTimePicker({
|
||
|
|
value,
|
||
|
|
onChange,
|
||
|
|
showTime = true,
|
||
|
|
format = 'YYYY-MM-DD HH:mm:ss',
|
||
|
|
placeholder = '',
|
||
|
|
disabled = false,
|
||
|
|
}: DateTimePickerProps) {
|
||
|
|
return (
|
||
|
|
<DatePicker
|
||
|
|
value={value}
|
||
|
|
onChange={(next) => onChange(next || null)}
|
||
|
|
showTime={showTime ? { format: 'HH:mm:ss' } : false}
|
||
|
|
format={format}
|
||
|
|
placeholder={placeholder}
|
||
|
|
disabled={disabled}
|
||
|
|
style={{ width: '100%' }}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
}
|