NumericSelector widget throws an error after hours of testing

Hey guys after hours of testing my numericSelector widget throws an error. Error “The value should be a number, a parseable string or an array of those.”. The Attributename is an number, a Unix timestamp to be precisly. What is wrong anyone can help?

search.addWidget(
  instantsearch.widgets.numericSelector({
   container: '#date',
    attributeName: 'created_at_seconds',
    operator: '>=',
    options: [
      {label: 'All products'},
      {label: 'Today', value: (Math.round(new Date()/1000) - 86400)},
      {label: 'Week', value: (Math.round(new Date()/1000) - 604800)},
      {label: 'Month', value: (Math.round(new Date()/1000) - 2592000)},
    ]
  })
);

Hello, can you show us a data sample of your index that includes the created_at_seconds attribute?

Yes of course.

Edit: Solved! You have to add an default value. Should look like this:

{label: 'All products', value: 0},
{label: 'Today', value: (Math.round(new Date()/1000) - 86400)},
{label: 'Week', value: (Math.round(new Date()/1000) - 604800)},
{label: 'Month', value: (Math.round(new Date()/1000) - 2592000)},
1 Like