Google Timezone api invalid timestamp param

Viewed 40

I'm using Timezone google API. Because of the timestamp param, I'm getting INVALID_REQUEST status. This is my action:

export const getTimezone = (lat, lng, timestamp) => (dispatch) => {
  axios
    .get(
      `https://maps.googleapis.com/maps/api/timezone/json?location=${lat}, ${lng}&timestamp=${timestamp}&key=API-KEY`
    )
    .then(({ data }) => {
      dispatch({ type: GET_TIMEZONE, payload: { timezone: data } });
    });
};

And this is my call from the component:

  useEffect(() => {
    if (coordinates) {
      dispatch(
        getTimezone(coordinates.lat, coordinates.lng, new Date().getTime())
      );
    }
  }, [coordinates]);

I also tried to pass a Date.now() as a timestamp param.

What is the correct timestamp param value?

0 Answers
Related