SHARE
TWEET

Liquid example for DoW and ToD - for Mark9531

maximillianx Aug 4th, 2015 21 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {% capture CurrentDay %}{{ now | date:"%A" }}{% endcapture %}
  2. {% assign DoW = "Monday,Tuesday,Wednesday,Thursday,Friday" %}
  3.  
  4. # matches substrings, case sensitive
  5. {% if DoW contains CurrentDay %}
  6.         Today is a work day! - - Place some logic here that would handle work-hours.
  7.         {% if CurrentTime > TimeBegin %}
  8.                 {% if CurrentTime < TimeEnd %}
  9.                         {{ RegularHoursText }}
  10.                 {% else %}
  11.                         {{ AfterHoursText }}
  12.                 {% endif %}
  13.         {% else CurrentTime < TimeBegin %}
  14.                 {{ AfterHoursText }}
  15.         {% endif %}
  16. {% else %}
  17.         Today is NOT a work day!
  18.         {{ AfterHoursText }}
  19. {% endif %}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top