Display day ranges in Drupal

Categories Drupal

Ran into a comp today that required the dates to be displayed like:

Monday – Tuesday, Thursday – Saturday

However the client wanted the UI to use checkboxes for each day of the week.  Quick and dirty way to get this to work was to configure the checkbox values in Drupal to be:

Then in the preprocessor for the node (the checkbox field is field_days_of_week):

Now you have an array of Start – End formatted day ranges you can use in your template file or further preprocess code.