Filter for age for users older than Epoch (born before 1970)

Hey all,

We’d like to be able to filter our users index by “Above 18 years old” or “Between 25-30 years old”, as well as sort by age. We’ve added birthdate as an ISO timestamp for our User objects in our index, but found that in order to sort/filter by dates, we should use Unix timestamps (

That’s fine and makes sense, except we have users that were born before Epoch (1970).

How is that handled in Algolia?

Thanks :smile:

Hi @jm1,

You should be able to convert your timestamps using a negative number for anything prior to 1970 such as this Stackoverflow suggests.

Since Algolia is schemaless, we treat them as integers so that we can sort numerically.

Let us know how this works for you!

1 Like