Error in Time Range Validation for 'To 00:00'

Created on 27 November 2023, 12 months ago
Updated 2 December 2023, 12 months ago

Problem/Motivation

The current implementation generates an error message when setting the time range 'To 00:00,' mistakenly indicating that the hours exceed the allowed limits, despite the values being within the specified time range provided in the field settings.

Steps to reproduce

Office hours Field Settings

Number of time slots per day: 4
Time element type: HTML5 time input
Time notation: 12 hour time
Time increments: 1 minute
Allow 'all day' situations: No
Allow a comment per time slot: Allow comments (HTML tag possible)
Allow exception days: Yes
Allow seasons: No
Validate hours: No
Require Start time: No
Require End time: No
Limit hours - from: 06:00 (6:00 am)
Limit hours - until: 00:00 (12:00 am)
Allowed number of values: Unlimited

Configs:

  time_format: g
  element_type: office_hours_datetime
  increment: 1
  valhrs: false
  required_start: false
  limit_start: '6'
  required_end: false
  limit_end: '0'
  all_day: false
  exceptions: true
  seasons: false
  comment: 1
  cardinality_per_day: 4
module: office_hours
locked: false
cardinality: -1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

If you try to set the value to the field "From 16:00 To 00:00", an error message is thrown "Hours are outside limits (6:00 am - 12:00 am )".

Proposed resolution

Class OfficeHoursBaseSlot line 284
improve condition check for elseif (!$all_day_allowed && (!empty($limit_start) || !empty($limit_end)))

🐛 Bug report
Status

Fixed

Version

1.12

Component

Code

Created by

🇩🇪Germany vesnag

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024