Advertisement
maximillianx

Liquid example for DoW and ToD - for Mark9531

Aug 4th, 2015
135
0
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 %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement