|
|
@ -27,12 +27,19 @@ export default function DatePicker(props) { |
|
|
|
const validateTimeInput = (selectedDate) => { |
|
|
|
const hour = moment(selectedDate, "HH:mm").format("HH:mm"); |
|
|
|
const day_month = moment(date, "DD-MM-YYYY").format("DD-MM-YYYY"); |
|
|
|
const eventDateTime = moment( |
|
|
|
const dateTime = moment( |
|
|
|
day_month + "T" + hour, |
|
|
|
"DD-MM-YYYYTHH:mm" |
|
|
|
).format("DD-MM-YYYYTHH:mm"); |
|
|
|
if ( |
|
|
|
moment(new Date(), "DD-MM-YYYYTHH:mm").format("DD-MM-YYYYTHH:mm") < eventDateTime) { |
|
|
|
).toObject(); |
|
|
|
var dateTime_event = new Date( |
|
|
|
dateTime.years, |
|
|
|
dateTime.months, |
|
|
|
dateTime.date, |
|
|
|
dateTime.hours, |
|
|
|
dateTime.minutes |
|
|
|
); |
|
|
|
var today = new Date(); |
|
|
|
if (dateTime_event > today) { |
|
|
|
Alert.alert("Horário inválido", "Selecione um horário válido", [ |
|
|
|
{ text: "OK", onPress: () => renderDatePicker() }, |
|
|
|
]); |
|
|
@ -63,7 +70,9 @@ export default function DatePicker(props) { |
|
|
|
setShow(false); |
|
|
|
setMode("date"); |
|
|
|
} else { |
|
|
|
setTime(moment()); |
|
|
|
//setTime(moment());
|
|
|
|
setShow(false); |
|
|
|
setMode("date"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|