Filter HTML elements by current date (great for Jekyll)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

jQuery Date Filter

jQuery Date Filter is a tiny library that does one thing; filter content by current date. This is useful for static sites generated by Jekyll where time based content isn't removed until the site is rebuilt. I use jQuery Date Filter on my homepage to hide past events (upcoming gigs). Now I don't have to rebuild my site to remove a past event!

How to use

Add a "data-date-filter" attribute to any element with the value set as a date:

  <li data-date-filter="{{}}">

The date format expected is a datetime which Jekyll will output by default.

Then call the library like so:


If an item's date is in the past then this item will be removed from the DOM. By default a buffer of 1 day is removed from the cutoff date, so an event starting at 0:00 today wont be removed until 0:00 tomorrow.

Configuration options

Name Default value Description
cutoff Current datetime Remove item(s) after this date.
buffer -1 Days to decrease or increase cutoff by.
emptyText Sorry, no results. Text to show when there are no items.