Home › Forums › Quform WordPress › Different periods depending on the day of the week
- This topic has 9 replies, 3 voices, and was last updated 1 year, 6 months ago by Ally.
- AuthorPosts
- March 30, 2023 at 11:39 am #35314brandworkerParticipant
We are currently creating a small reservation facility using your tool. Here for we use the date and time field. Now we would like to integrate the opening hours here. That is, the visitor selects a Monday, Tuesday, Wednesday or Thursday in the calendar offers the time field 17:00 to 23:00 clock.
If you choose a Friday, it offers 16:00 to 01:00 and Saturdays and Sundays other times.
So is it possible to set different time periods for different days of the week?March 31, 2023 at 9:31 am #35320AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 5, 2023 at 3:40 pm #35352brandworkerParticipantHello thank you that worked well.
But one more question. Is it possible that you can say if someone books today that the earliest time is only 2 hours later? This works but if I then select tomorrow or next week, it also takes the current time plus 2 hours and not the complete period of the selected day.
April 6, 2023 at 9:39 am #35360AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 6, 2023 at 12:05 pm #35364brandworkerParticipantjQuery(function ($) { var datepicker = $('.quform-field-1_4').data('kendoDatePicker'), timepicker = $('.quform-field-1_5').data('kendoTimePicker'); if (window.kendo && datepicker && timepicker) { datepicker.setOptions({ change: function () { var date = datepicker.value(); if (date) { var dayOfWeek = date.getDay(), times = []; if (dayOfWeek === 0) { // Sun times = [ '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00' ]; } else if (dayOfWeek === 1) { // Mon times = [ '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00' ]; } else if (dayOfWeek === 2) { // Tue times = [ '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00' ]; } else if (dayOfWeek === 3) { // Wed times = [ '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00' ]; } else if (dayOfWeek === 4) { // Thu times = [ '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00' ]; } else if (dayOfWeek === 5) { // Fri times = [ '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30', '00:00' ]; } else if (dayOfWeek === 6) { // Sat times = [ '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30', '00:00' ]; } var dates = [], i = 0, length = times.length, d; for ( ; i < length; i++) { d = kendo.parseDate(times[i]); if (d instanceof Date) { dates.push(d); } } timepicker.setOptions({ dates: dates }); } } }); } });
We are in Germany (German) 24 Hour
April 7, 2023 at 12:17 pm #35371AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 14, 2023 at 2:01 pm #35589laboulbeneParticipantHi,
first of all thank you for that tip.I need to avoid people to book on Monday.
When I put :
} else if (dayOfWeek === 1) { // Mon
times = [];
the time picker is still present and full.I need to deny booking on Monday.
Any help would be appreciated.
Thanks in advance
LudovicJune 15, 2023 at 10:03 am #35593AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 15, 2023 at 2:32 pm #35598laboulbeneParticipantHi,
thank you for the answer, but it don’t works.
A you can see on screen captures I have copied and paste the code, using code snippet and replace the unique ID with my mine (7_4)If I try to book, there is an Ajax error
Thanks for your help
Attachments:
You must be logged in to view attached files.June 16, 2023 at 10:24 am #35606AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.