List of Timeband Restriction Rules in Signworks Inventory

This is my attempt to suss out all the rules that govern timebands in the Inventory app's Sign Editor form.  I try, whenever possible, to disable/enable controls and populate values programmatically.  For instance, when a user changes the start day of a band, I automatically set the end day to the same value.  This makes it harder to get the validation error "Start day is after end day".  Likewise, when a user has an error in their start/end times , I disable the start/end day controls until they fix the error.  I've found this reduces the amount of validation code.  There are also a few validation rules that the user cannot break using the interface (for instance, they cannot set a value to NULL), but they still need to be checked because the database contains these errors.  That's why it is important to validate the bands when the editor is initializing.  All the restrictions code can be found in functions in SignEditor.js and TimebandEditor.js  

General Rules

  •  When adding a new timeband, it is initialized with Monday/Monday/Anytime/Anytime
  • R-NS-012 and R-NS-022 can ignore overnight restrictions
  • For all other MUTCDs, the timeband cannot go overnight ( cross the line between 0345AM and 0400AM)
  • The dropdowns must all include the NULL value, because unfortunately there are still a lot of NULLs in the database.  If the NULL value is detected (any time or day), a validation error “Cannot Have NULL in Time Restriction” is displayed.  NULL values in dropdown are disabled (but visible) so the user cannot make a timeband with NULL values.
  • Any time a timeband validation error occurs , the Add button  is disabled so the user cannot make any more timebands until the problem is fixed.


Special Cases

  • If the start DAY of a band is set to ANYTIME, the end day, start and end time are all also set to ANYTIME.  And disabled.
  • If the start TIME of a band is set to ANYTIME, the end time is automatically set to ANYTIME as well, and disabled.  If the start time is changed from ANYTIME to some value, the end time is enabled and the validation error “ANYTIME cannot be an end time” is displayed.
  • ANYTIME and SCHOOLDAYS are values in the END day dropdown, but are disabled and can only be set programmatically.
  • If the START day of a band is set to SCHOOLDAYS, the end day is set to SCHOOLDAYS (disabled) , start time is set to ANYTIME (enabled), end time is set to ANYTIME (disabled).


Validation Errors Within A Timeband

  • start day cannot be after end day.
  • if start time is not set to ANYTIME, end time cannot be ANYTIME.
  • start time cannot be after end time, unless overnight restrictions can be ignored.
  • start time cannot be the same as end time.  (but start day can be the same as end day).
  • no day or time value can be zero.  There is no dropdown option in my code to allow this, BUT there are records in the database where the value of a day or time is zero.


Validation Errors Between Timebands

  • two timebands cannot overlap in both days and times.
  • a band with ANYTIME start time will conflict with any bands it overlaps.



Control Disabled Matrix

T= control is disabled   F = control is enabled

SituationStart DayEnd DayStart TimeEnd TimeHours
All editing on form has been locked by a validation error1TTTTT
ANYTIME selected as start dayFTTTT
SCHOOLDAYS selected and start time ANYTIMEFTFTF
SCHOOLDAYS selected and start time is a specific timeTTFFT
ANYTIME is set to start time, set end time to ANYTIME and disable itFFFTF
Validation error - End day is before Start dayFFTTT
When SCHOOLDAYS is selected as Start dayFTFTF
When SCHOOLDAYS is selected with a start and end timeFTFFF
Validation error - something is wrong with start and end timeTTFFT


  1.  This occurs in my app when the sign status is not set to Active, no other editing can take place until the status is changed to Active