Created
December 14, 2022 05:48
-
-
Save khsuzan/a19c392c299cc081bb68084d1db75ffe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dateInput = document.getElementById('date'); | |
dateInput.addEventListener('change', e => { | |
const inputDateString = e.target.value; | |
const today = new Date(); | |
const minDate = new Date(inputDateString); | |
minDate.setDate(minDate.getDate() + 1); | |
if(today<minDate){ | |
// this block will run only when user input date at least greater 1 day | |
// comparison to today date | |
console.log(inputDateString) | |
console.log("I go next") | |
}else{ | |
// if date is less then one day greater this block | |
// will run | |
console.log("Date error") | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment