Problem/Motivation

Entering dates in the time intervals area as instructed in the tooltip does not produce any result.

For example, entering the following produces a booking widget that says there are no time slots available for any day:

10:00|13:00(2026-02-27)
10:00|13:00(2026-02-28)
10:00|13:00(2026-03-01)
10:00|13:00(2026-03-02)

Using days instead will product a widget with time slots available:

10:00|13:00(Friday)
10:00|13:00(Saturday)
10:00|13:00(Sunday)
10:00|13:00(Monday)

Steps to reproduce

Create a webform_booking element like this:

book_a_date:
  '#type': booking
  '#title': 'Book a date'
  '#required': true
  '#start_date': '2026-02-23'
  '#end_date': '2026-03-07'
  '#time_interval': |
    10:00|13:00(2026-02-27)
    10:00|13:00(2026-02-28)
    10:00|13:00(2026-03-01)
    10:00|13:00(2026-03-02)
  '#slot_duration': 30
  '#seats_slot': 6
  '#excluded_weekdays':
    Mon: 0
    Tue: 0
    Wed: 0
    Thu: 0
    Fri: 0
    Sat: 0
    Sun: 0
  '#date_label': 'Choose the date for your appointment:'
  '#slot_label': 'Choose the time slot for your appointment:'
  '#no_slots': 'No time slots available.'
  '#default_price': ''

When viewing the form, no date has available time slots.

Proposed resolution

Check the code to see why the date values in Time Intervals field are being ignored.

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

chrisla created an issue. See original summary.

chrisla’s picture

when WebformController getAvailableDays() method runs, the $availableDays array it returns does not contain the expected dates loaded into Time Intervals field.

This, in turn, is because getAvailableSlots() does not return any available slots for the date that is included in Time Intervals field.

Within getAvailableSlots(), there is nothing that processes specific dates. This loop only processes based on day of the week, where $specificDayIntervals can also hold date values:

// Process specific day intervals.
if (array_key_exists($dayOfWeek, $specificDayIntervals)) {
  $addSlots($specificDayIntervals[$dayOfWeek]);
}
else {
  // If no specific intervals for this day, use regular intervals.
  $addSlots($regularIntervals);
}

Here is my test $specificDateIntervals, which contains a day of the week and a date:

array:2 [
  "Wednesday" => array:1 [
    0 => "9:00|11:00"
  ]
  "2026-02-27" => array:1 [
    0 => "9:00|11:00"
  ]
]

So, I believe code needs to be added that actually checks for date-specific entries in $specificDateIntervals and adds slots based on them.

nickolaj made their first commit to this issue’s fork.

nickolaj’s picture

Status: Active » Needs review

The `getAvailableSlots()` method only checks day-of-week keys (e.g. "Friday") in `$specificDayIntervals` but never checks date keys (e.g. "2026-02-27"). Added a check for the formatted date with priority over day-of-week matching.

  • rfmarcelino committed 56b82d0c on 1.1.x
    #3575334 - Using dates in Time Intervals area does not work
    
rfmarcelino’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

rfmarcelino’s picture

Status: Fixed » Closed (fixed)