Why aren't my results refined?

I am trying to reduce the results returned with this custom range widget:

This is my code:

const setLastEditedRefinement = (refine, date_from, date_to) => {
	// Refine results.
	refine([new Date(date_from).getTime(), new Date(date_to).getTime()]);

const datePicker = instantsearch.connectors.connectRange((options, isFirstRendering) => {
	if (isFirstRendering) {
		const { refine } = options;

		document.getElementById('last-edited-from').value = new Date('01/01/2000').toISOString().split('T')[0];
		document.getElementById('last-edited-to').value = new Date(Date.now()).toISOString().split('T')[0];

		$('#last-edited-from').on('change', e => {
			let date_from = e.target.value;
			let date_to = $('#last-edited-to').val();
			setLastEditedRefinement(refine, date_from, date_to);
		$('#last-edited-to').on('change', e => {
			let date_from = $('#last-edited-from').val();
			let date_to = e.target.value;
			setLastEditedRefinement(refine, date_from, date_to);

The event fires and both variables have data. But there is no refinement in the hits.

Why aren’t my results refined?


Hi @ecoffman,

Could you provide a working example of your issue? It will help us a to better understand the problem. We provide template in order to avoid you the boilerplate part. You can find it on CodeSandbox.


Samuel, there is no facet that allows me to do a numeric refinement. Or is there one but just not listed? If so, what is it?