I have a problem selecting the date more than today in the DateTime picker for reactJs. If I select more than today and time, then I click submit button, it will alert Value must be 21/09/2022 10:02 PM or later.
const formatIosDate = moment(new Date()).format("YYYY-MM-DD");
const formatIosTime = moment(new Date()).format("HH:mm");
const newIosDateValue = formatIosDate + "T" + formatIosTime;
const [iosFormatWeeklyToDay, setIosFormatWeeklyToDay] = useState(newIosDateValue);
<Form.Control
type="datetime-local"
name="startDate"
value={iosFormatWeeklyToDay}
onChange={(e) => {
setIosFormatWeeklyToDay(e.currentTarget.value);
}}
min={newIosDateValue}
/>
I am using formik to send the date.
<Button
type="submit"
variant="primary"
disabled={formik.isSubmitting}
>
{formik.isSubmitting ? (
<FormattedMessage id="GENERAL.SAVING" />
) : (
<FormattedMessage id="GENERAL.SAVE" />
)}
</Button>
May I know how to remove this alert message, this alert message I don't want to use Value must be 21/09/2022 10:02 PM or later.
Hope someone can guide me on how to solve this problem. Thanks.
