In my hits, i have a prop that contains added .. and when i try to make a filter on date added, list of common date appears. How can I make a filter that says.. 1 day ago, 2 days ago, 1 week ago etc.. then filter the results.
so instead of showing full list of dates as filter, i can just personalize it depending on what i want.
Script:
//Algolia Widget for Date Added.
search.addWidget(
instantsearch.widgets.menu({
container: '#added-menu',
attributeName: 'added',
limit: 10,
templates: {
header: 'Added'
}
})
);
//Date added will display the whole list of common dates.
Update : I was able to find solution for handling the relative date and it is by the use filter named numericSelector found in algolia documentation. the situation is, i just need to copy the relative dates we have in our old App.
here are the constraints :
daysBefore() is a function that returns the current date minus the number of days and then converted to a linux timestamp.