Skip to content

Instantly share code, notes, and snippets.

@su-narthur
Created June 6, 2018 14:24
Show Gist options
  • Save su-narthur/1473c4209cacf663604e65e893e70517 to your computer and use it in GitHub Desktop.
Save su-narthur/1473c4209cacf663604e65e893e70517 to your computer and use it in GitHub Desktop.
Use SUFramework API to display sunset times
{% set dayOfWeekIndex = date()|date("N") %}
{% if dayOfWeekIndex == 5 %}
Sunset tonight: {{ su.calendar.sunsetTime|date( "H:i:s" ) }}<br>
Sunset tomorrow: {{ su.calendar.sunsetTime( '+1 day' )|date( "H:i:s" ) }}<br>
{% elseif dayOfWeekIndex == 6 %}
Sunset tonight: {{ su.calendar.sunsetTime|date( "H:i:s" ) }}<br>
Sunset next Friday: {{ su.calendar.sunsetTime( 'next friday' )|date( "H:i:s" ) }}<br>
Sunset next Sabbath: {{ su.calendar.sunsetTime( 'next saturday' )|date( "H:i:s" ) }}<br>
{% else %}
Sunset next Friday: {{ su.calendar.sunsetTime( 'next friday' )|date( "H:i:s" ) }}<br>
Sunset next Sabbath: {{ su.calendar.sunsetTime( 'next saturday' )|date( "H:i:s" ) }}<br>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment