I have been trying to work on something with dates and I was wondering how to check if it is less than 30mins or 15mins difference then should call a function.
let btnCheck = document.querySelector('button');
let result = document.querySeletor('h1');
let current = new Date();
let date = new Date('01/01/2021');
btnCheck.addEventListener('click', () => {
let ms1 = current.getTime();
let ms2 = date.getTime();
result.innerText = ms2 < ms1;
});
So far it results in a true or false but I wanted to add something if the current date is less than the date by 15mis or 30 mins show a button.
Thank you in advance! Much appreciated!