Home › Forums › Quform WordPress › Disable certain time slot
This topic is: not resolved
- This topic has 2 replies, 2 voices, and was last updated 4 years, 3 months ago by Ally.
Viewing 3 posts - 1 through 3 (of 3 total)
- AuthorPosts
- August 5, 2020 at 2:09 pm #31734MobisolarParticipant
Hi, I’m trying to disable the time slots during lunch.
Found some code on here to assign specific time slots each day but tbh I just like to remove 12:00 12:30 and 13:00 from each day.
Currently have this, which does the trick somewhat, but you can still select those times and then change the date after. (the 12:00, 12:30 and 13:00 only get removed from the list if you select a date first)
Is there an easier solution?
jQuery(function ($) { var datepicker = $('.quform-field-6_27').data('kendoDatePicker'), timepicker = $('.quform-field-6_28').data('kendoTimePicker'); if (window.kendo && datepicker && timepicker) { datepicker.setOptions({ change: function () { var date = datepicker.value(); if (date) { var dayOfWeek = date.getDay(), times = [ '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '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' ]; if (dayOfWeek === 0) { // Sun times = []; } else if (dayOfWeek === 1) { // Mon times = [ '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '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' ]; } else if (dayOfWeek === 2) { // Tue times = [ '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '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' ]; } else if (dayOfWeek === 3) { // Wed times = [ '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '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' ]; } else if (dayOfWeek === 4) { // Thu times = [ '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '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' ]; } else if (dayOfWeek === 5) { // Fri times = [ '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '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' ]; } else if (dayOfWeek === 6) { // Sat times = [ '08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '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' ]; } 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 }); } } }); } });
August 10, 2020 at 1:55 pm #31753MobisolarParticipantCan I get a reply on this? 🙂
August 11, 2020 at 9:57 am #31756AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.