Published 2020-10-03.
Last modified 2023-05-18.
Time to read: 1 minutes.
jekyll_plugins collection.
time_since is a collection of Liquid filters that return the elapsed time since a date or date and time.
The filters are years_since, months_since, days_since, hours_since, minutes_since and seconds_since.
Installation
Add the following highlighted line to your Jekyll project's Gemfile,
within the jekyll_plugins group:
group :jekyll_plugins do gem 'jekyll_time_since' end
And then execute:
$ bundle install
Usage Examples
These tags all work in a similar manner;
they accept one parameter, which is either a date string (YYYY-MM-dd) or
an ISO 8601-1:2019 datetime string (YYYY-MM-ddThh:mm).
Just a year can be specified, which implies Jan 1 at midnight.
The date and time strings can be surrounded with quotes or double quotes.
Time zone can be omitted, or specified as GMT, Z, or +/- HHMM/code>.
{{ "1956" | years_since }}: 70
{{ "1956-10-15" | years_since }}: 69
{{ "1956-10-15T01:02" | years_since }}: 69
{{ "1956-10-15T01:02:00Z" | years_since }}: 69
{{ "1956" | months_since }}: 848
{{ "1956-10-15" | months_since }}: 839
{{ "1956-10-15T01:02" | months_since }}: 839
{{ "1956-10-15T01:02:00Z" | months_since }}: 839
{{ "1956" | weeks_since }}: 3690
{{ "1956-10-15" | weeks_since }}: 3649
{{ "1956-10-15T01:02" | weeks_since }}: 3649
{{ "1956-10-15T01:02:00Z" | weeks_since }}: 3649
{{ "1956" | days_since }}: 25832
{{ "1956-10-15" | days_since }}: 25544
{{ "1956-10-15T01:02" | days_since }}: 25544
{{ "1956-10-15T01:02:00Z" | days_since }}: 25544
{{ "1956" | hours_since}}: 619969
{{ "1956-10-15" | hours_since }}: 613058
{{ "1956-10-15T01:02" | hours_since }}: 613057
{{ "1956-10-15T01:02:00Z" | hours_since }}: 613061
{{ "1956" | minutes_since }}: 37198161
{{ "1956-10-15" | minutes_since }}: 36783501
{{ "1956-10-15T01:02" | minutes_since }}: 36783439
{{ "1956-10-15T01:02:00Z" | minutes_since }}: 36783679
{{ "1956" | seconds_since }}: 2231889705
{{ "1956-10-15" | seconds_since }}: 2207010105
{{ "1956-10-15T01:02" | seconds_since }}: 2207006385
{{ "1956-10-15T01:02:00" | seconds_since }}: 2207006385