|
|
@ -25,9 +25,15 @@ export default function DatePicker(props) { |
|
|
|
const [time, setTime] = useState(moment(defaultDate)); |
|
|
|
|
|
|
|
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( |
|
|
|
day_month + "T" + hour, |
|
|
|
"DD-MM-YYYYTHH:mm" |
|
|
|
).format("DD-MM-YYYYTHH:mm"); |
|
|
|
if ( |
|
|
|
!moment().isSameOrAfter(selectedDate) && |
|
|
|
new Date(moment()).getDay() == new Date(date).getDay() |
|
|
|
moment(new Date(), "DD-MM-YYYYTHH:mm").format("DD-MM-YYYYTHH:mm") < |
|
|
|
eventDateTime |
|
|
|
) { |
|
|
|
Alert.alert("Horário inválido", "Selecione um horário válido", [ |
|
|
|
{ text: "OK", onPress: () => renderDatePicker() }, |
|
|
@ -99,7 +105,7 @@ export default function DatePicker(props) { |
|
|
|
mode={mode} |
|
|
|
is24Hour={true} |
|
|
|
locale={"pt-br"} |
|
|
|
// minimumDate={props.minimumDate}
|
|
|
|
// minimumDate={props.minimumDate}
|
|
|
|
maximumDate={new Date(moment())} |
|
|
|
formatChosenDate={(selectedDate) => { |
|
|
|
if (mode == "date") { |
|
|
|