Skip to content

Instantly share code, notes, and snippets.

@gterrill
Created March 13, 2013 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gterrill/5156454 to your computer and use it in GitHub Desktop.
Save gterrill/5156454 to your computer and use it in GitHub Desktop.
Displaying pickup date and time. Time is 12 hour clock.
{% for attribute in attributes %}{{ attribute | first | replace: 'booking-time', 'Time' | replace: 'booking', 'Pickup' }}: {% if attribute.first == 'booking-time' %}{% assign t = attribute.last | split: ':' %}{% assign hour = t[0] | minus:0 %}{% if hour > 12 %}{{ t[0] | minus:12 }}:{{ t[1] }} pm{% else %}{{ t[0] }}:{{ t[1] }} am{% endif %}{% else %}{{ attribute | last }}{% endif %}{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment