Yoolk Liquid

Home Filters Misc-filters

Misc Filters

Provides miscellaneous filters.

date

Converts a timestamp into another date format.

Input

{{ listing.created_at | date: "%a, %b %d, %y" }}

Output

Tue, Apr 22, 14

The date parameters are listed below:

%a

Abbreviated weekday.

{{ listing.created_at | date: "%a" }}
<!-- Sat -->
%A

Full weekday name.

{{ listing.created_at | date: "%A" }}
<!-- Tuesday -->
%b

Abbreviated month name.

{{ listing.created_at | date: "%b" }}
<!-- Jan -->
%B

Full month name

{{ listing.created_at | date: "%B" }}
<!-- January -->
%c

Preferred local date and time representation

{{ listing.created_at | date: "%c" }}
<!-- Tue Apr 22 11:16:09 2014 -->
%d

Day of the month, zero-padded (01, 02, 03, etc.).

{{ listing.created_at | date: "%d" }}
<!-- 04 -->
%-d

Day of the month, not zero-padded (1,2,3, etc.).

{{ listing.created_at | date: "%d" }}
<!-- 4 -->
%D

Formats the date (dd/mm/yy).

{{ listing.created_at | date: "%D" }}
<!-- 04/22/14 -->
%e

Day of the month, blank-padded ( 1, 2, 3, etc.).

{{ listing.created_at | date: "%e" }}
<!-- 3 -->
%F

Returns the date in ISO 8601 format (yyyy-mm-dd).

{{ listing.created_at | date: "%F" }}
<!-- 2014-04-22 -->
%H

Hour of the day, 24-hour clock (00 - 23).

{{ listing.created_at | date: "%H" }}
<!-- 15 -->
%I

Hour of the day, 12-hour clock (1 - 12).

{{ listing.created_at | date: "%H" }}
<!-- 7 -->
%j

Day of the year (001 - 366).

{{ listing.created_at | date: "%j" }}
<!-- 245 -->
%k

Hour of the day, 24-hour clock (1 - 24).

{{ listing.created_at | date: "%k" }}
<!-- 14 -->
%m

Month of the year (01 - 12).

{{ listing.created_at | date: "%m" }}
<!-- 04 -->
%M

Minute of the hour (00 - 59).

{{ listing.created_at | date: "%M" }}
<!-- 53 -->
%p

Meridian indicator (AM/PM).

{{ listing.created_at | date: "%p" }}
<!-- PM -->
%r

12-hour time (%I:%M:%S %p)

{{ listing.created_at | date: "%r" }}
<!-- 03:20:07 PM -->
%R

24-hour time (%H:%M)

{{ listing.created_at | date: "%R" }}
<!-- 15:21 -->
%T

24-hour time (%H:%M:%S)

{{ listing.created_at | date: "%T" }}
<!-- 15:22:13 -->
%U

The number of the week in the current year, starting with the first Sunday as the first day of the first week.

{{ listing.created_at | date: "%U" }}
<!-- 16 -->
%W

The number of the week in the current year, starting with the first Monday as the first day of the first week.

{{ listing.created_at | date: "%W" }}
<!-- 16 -->
%w

Day of the week (0 - 6, with Sunday being 0).

{{ listing.created_at | date: "%w" }}
<!-- 2 -->
%x

Preferred representation for the date alone, no time. (mm/dd/yy).

{{ listing.created_at | date: "%x" }}
<!-- 15:22:13 -->
%X

24-hour time (%H:%M:%S)

{{ listing.created_at | date: "%X" }}
<!-- 13:17:24 -->
%y

Year without a century (00.99).

{{ listing.created_at | date: "%T" }}
<!-- 14 -->
%Y

Year with a century.

{{ listing.created_at | date: "%T" }}
<!-- 2014 -->
%Z

Time zone name.

{{ listing.created_at | date: "%Z" }}
<!-- EDT -->
random

generate random numbers.

{{ 5 | random }}
# => 4 (the result is randomly print)
toggle_class_name

Return class_name if condition evaluate to true otherwise nil is returned.

{{ 'active' | toggle_class_name: true }}
# => 'active'
default

Sets a default value for any variable with no assigned value. Can be used with strings, arrays, and hashes.

Input

Dear {{ person.name | default: "person" }}

Input

<!-- if person.name is nil -->
Dear person
default_pagination

Creates a set of links for paginated results. Used in conjunction with the paginate variable.

Input

{{ paginate | default_pagination }}

Input

<span class="page current">1</span>
<span class="page"><a href="/galleries?page=2" title="">2</a></span>
<span class="page"><a href="/galleries?page=3" title="">3</a></span>
<span class="deco">&hellip;</span>
<span class="page"><a href="/galleries?page=17" title="">17</a></span>
<span class="next"><a href="/galleries?page=2" title="">Next &raquo;</a></span>
google_static_map_url

Generate google static map url for a listing object with the provided options such as: maptype, size, …. Find out more HERE.

Input

{{ listing | google_static_map_url: size: '300x200' }}

Output

https://maps.googleapis.com/maps/api/staticmap?center=40.714728%2C-73.998672&maptype=roadmap&size=300x200&zoom=13&markers=color%3Ared%7C40.714728%2C-73.998672
open_closed

Format the display of the opening and closed hour of the business_hour object.

Input

{{ business_hour | open_closed: '%I:%M %p-%I:%M %p' }}

Output

08:00 AM-12:00 PM