You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.1 KiB
31 lines
1.1 KiB
import React from "react";
|
|
import TextField from "@mui/material/TextField";
|
|
import AdapterDateFns from "@mui/lab/AdapterDateFns";
|
|
import LocalizationProvider from "@mui/lab/LocalizationProvider";
|
|
import DateRangePicker, { DateRange } from "@mui/lab/DateRangePicker";
|
|
import Box from "@mui/material/Box";
|
|
import { DatePickerProps } from "../types";
|
|
|
|
export default function DatePicker(props: DatePickerProps) {
|
|
return (
|
|
<LocalizationProvider dateAdapter={AdapterDateFns}>
|
|
<DateRangePicker
|
|
value={props.value}
|
|
minDate={props.minDate}
|
|
maxDate={props.maxDate}
|
|
onChange={(newValue: DateRange<Date>) => {
|
|
props.setValue(newValue);
|
|
}}
|
|
startText="Kezdeti dátum"
|
|
endText="Végső dátum"
|
|
renderInput={(startProps, endProps) => (
|
|
<>
|
|
<TextField {...startProps} />
|
|
<Box sx={{ mx: 2 }}> - </Box>
|
|
<TextField {...endProps} />
|
|
</>
|
|
)}
|
|
/>
|
|
</LocalizationProvider>
|
|
);
|
|
}
|
|
|