Jump to content

Emari

Members
  • Posts

    6
  • Joined

  • Last visited

Emari's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I thought I could use the same script for weekdays but it seems like I'm doing something wrong. I want it to stop from choosing the same day and if time is after noon also stop from choosing the next day: var chosenDate = this.val(); var minDate = new Date(); var offset = +1; if(minDate.getDay() == chosenDate.getDay && minDate.getHours() >= 12) { // Add 1 day after noon offset = +2; } minDate.setDate(minDate.getDate() + offset); if(Date.parse(chosenDate) < Date.parse(minDate)){ this.valid(false,"error message"); return; } else { this.valid(true); } Help again...?
  2. This is exactly what I was looking for, thank you very much!!!😍
  3. I don't want saturday OR sunday to be available after noon on thursday. If I set it to 60 h then saturday will not be available before noon on thursday. It's hard to explain... For saturday there can be a time limit of 36 hours and for sunday there must be a time limit of 60 hours. How do I specify that with js? Two different time limits...?
  4. Yes, but 36 hours don't remove the option to choose sunday after 12.00 on thursday because there are more than 36 h between thursday and sunday. So I need another way to stop sunday from being available from 12.00 on thursday... I can't add more hours than 36 because then saturday won't be available... 🥴
  5. I need help... I have a datepicker where you are only allowed to choose weekends, the problem is that after noon on the thursday you may no longer choose the upcoming saturday or sunday. The script i have below with 36 hour check works for saturday but you can still choose sunday. Can anyone help me with this? var chosenDate = this.val(); var minDate = new Date(); minDate.setHours(minDate.getHours()+36); if(Date.parse(chosenDate) < Date.parse(minDate)){ this.valid(false,"error message"); return; } if (this.val().getDay() !== 0 && this.val().getDay() != 6 ) { this.valid(false,"error message"); return; } this.valid(true);
×
×
  • Create New...