I've used Solspace Calendar to create an "Office Holidays" calendar where we enter all of the dates/times we're closed for the holidays. The idea is to let visitors know if we're open for calls or not. That said, I'm not sure what the best way is to check and see if the current time/date lands on a holiday or not. Especially without looping through all holidays in the calendar.

Any suggestions on ways to check to see if we're currently in a "holiday"?

2 Answers 2


Wouldn't you only have to loop through the events on a specific day (today) to see if there is a match for a holiday (and not the entire calendar)? I believe you could use the "Day" loop with a date_range_start of current_time, couldn't you? And since your calendar entries are limited to office holidays, the return of any results for a given day would in fact mean there is a holiday.

So something like:

 {exp:calendar:day date_range_start="{current_time format="%Y-%m-%d"}"}
    {if calendar_no_results}
       Regular business hours today
       Today is a Holiday!
  • That's right. I don't want all holidays, just holidays for today's date, and even limited to 1 since even one means there is a company holiday. Commented Dec 16, 2013 at 16:21
  • Not sure {exp:calendar:day} is a good method, though, because it outputs template code that I don't need. Commented Dec 16, 2013 at 16:46

Creating an "Office Holidays" calendar is a good start. Within that calendar you would create your holiday "events" in the "Calendar: Events" channel.

If you're looking to list the upcoming holidays as a list, you can use {exp:calendar:cal}. Don't forget to use calendar_id="" or calendar_name="" is you just want to display events within your "Office Holidays" calendar:

  date_range_end="+6 months"

     Holiday "{event_title}" on {event_start_date format="%Y-%m-%d"}<br />


You can also create a calendar table using {exp:calendar:cal} (see the advanced example for a monthly calendar here), then use

 {if day_event_total > 0}Holiday!{/if}

...within the {display_each_day}{/display_each_day} tag pair to label days with holidays. Make sure the {events}{/events} tag pair is also present in the {display_each_day}{/display_each_day} tag pair.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.