fixed min and max datetimes
This commit is contained in:
@@ -6,7 +6,7 @@ import { Box, FormHelperText, IconButton, InputAdornment } from "@mui/material";
|
||||
import ClearIcon from "@mui/icons-material/Clear";
|
||||
import moment from "jalali-moment";
|
||||
|
||||
function MuiDatePicker({ value, setFieldValue, name, minDate, maxDate, helperText, placeholder, error, label }) {
|
||||
function MuiDatePicker({ value, disableFuture = true, setFieldValue, name, minDate, maxDate, helperText, placeholder, error, label }) {
|
||||
return (
|
||||
<>
|
||||
<Box sx={{ display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center" }}>
|
||||
@@ -20,7 +20,7 @@ function MuiDatePicker({ value, setFieldValue, name, minDate, maxDate, helperTex
|
||||
id={name}
|
||||
name={name}
|
||||
closeOnSelect
|
||||
disableFuture
|
||||
disableFuture={disableFuture}
|
||||
label={label}
|
||||
aria-describedby="component-helper-text"
|
||||
onChange={(value) => {
|
||||
|
||||
9
src/core/utils/makeDateTime.js
Normal file
9
src/core/utils/makeDateTime.js
Normal file
@@ -0,0 +1,9 @@
|
||||
export const makeDateTime = (date, time) => {
|
||||
if (!date) return null;
|
||||
const d = new Date(date);
|
||||
if (time) {
|
||||
const t = new Date(time);
|
||||
d.setHours(t.getHours(), t.getMinutes(), 0, 0);
|
||||
}
|
||||
return d;
|
||||
};
|
||||
Reference in New Issue
Block a user