ernie/ransack — Issue #65: Support for date macros would be helpful with saved searches
Author: ndbroadbent
Created: 2012-02-04 09:06:17+00:00
State: open

We are developing a 'saved search' feature, so that users can create shortcuts to a list of filters.
It would be really useful if users could search date fields by entering natural language dates and times, like `yesterday`. As well as being convenient, this would make our saved sets of filters extremely powerful, because `yesterday` would be expanded every time the search is executed.

An integration with the [chronic](https://github.com/mojombo/chronic) gem would handle this magnificently. It can parse a huge variety of date and time formats, so the user would be able to search for everything imaginable:

* 5/27/1979
* 1979-05-27
* 7 days ago
* this tuesday
* november
* 7 hours before tomorrow at noon

This can be implemented in a completely backwards compatible way, since regular dates & times would be effectively unchanged, and Ransack would also only parse the value fields with Chronic if the searched column is a DATE type.

What do you think? I'll work on this in a branch and see how it goes.