aroundLatLng algolia float

I’m trying to use HTML5’s native Geolocation API to search around a user’s actual long/lat rather than around their IP.

The long/lat that I get from my JS is correct.

For example, if I hardcode those like so

algoliaHelper.setQueryParameter('aroundLatLng', '55.809708199999996, -4.1557824')

Things work as I’d expect.

However, if I do

userLat = position.coords.latitude,
			userLng = position.coords.longitude
			const theFinalPositionIs = "'" + userLat + ", " + userLng + "'"
			console.log(theFinalPositionIs)

algoliaHelper.setQueryParameter('aroundLatLng', theFinalPositionIs)

I get an API error “Invalid value for “aroundLatLng” parameter, expected float”

What am I missing?

I’ve tried using template string as well but no joy there either.

Thanks.

Hi,

Could you copy/paste the result of console.log(theFinalPositionIs)?

Thanks

this got me sorted https://github.com/algolia/algoliasearch-helper-js/issues/516