import React from "react";
import {TextField} from "@mui/material";
import DateTimePicker from '@mui/lab/DateTimePicker';
import {LocalizationProvider} from "@mui/lab";
import DateAdapter from '@mui/lab/AdapterDayjs';
import pl from 'dayjs/locale/pl';

export interface TimePickerProps {
    label: string,
    value?: Date | null,
    handleChange: (newValue: Date | null) => void,
    disabled?: boolean
}

function SparkDateTimePicker(props: TimePickerProps) {
    return (
        <LocalizationProvider dateAdapter={DateAdapter} locale={pl}>
            <DateTimePicker
                label={props.label}
                value={props.value}
                onChange={props.handleChange}
                renderInput={(params) => <TextField {...params} />}
                disabled={props.disabled}
            />
        </LocalizationProvider>
    );
}

export default SparkDateTimePicker;
