xkjyeah / vue-google-maps

Google maps component for vue with 2-way data binding
https://xkjyeah.github.io/vue-google-maps/
1.88k stars 475 forks source link

utc_offset is deprecated as of November 2019 and will beturned off in November 2020. Use utc_offset_minutes instead. #675

Open albay13 opened 4 years ago

albay13 commented 4 years ago

How can i set the return fields as google maps api documentation said. https://developers.google.com/maps/documentation/javascript/place_field_js_migration

webblufter commented 4 years ago

Facing same issue any update on this? It was worknig before suddenly started to showing that error console error => https://i.imgur.com/QSVVEUe.png

utc_offset is deprecated as of November 2019 and will beturned off in November 2020. Use utc_offset_minutes instead. js:70:128 [Vue warn]: Error in v-on handler: "TypeError: e is undefined"

found in

---> at node_modules/vue2-google-maps/dist/components/autocomplete.vue

at src/components/GoogleMap.vue TypeError: "e is undefined"
albay13 commented 4 years ago

Any updates?

k-sai-kiranmayee commented 4 years ago

Since, these both utc_offset and opening_hours.open_now are going to be deprecated by the end of 2020, could we expect an update?

manhtlu commented 4 years ago

I am having the same problem, is there any effective solution? Tks !

Gyurmatag commented 4 years ago

Please fix this!

epixian commented 4 years ago

Based on this stackoverflow answer, calling the Google Maps API without specifying any fields returns all fields (incl utc_offset). PR #688 provides a workaround.

mean-cj commented 4 years ago

i same problem , Please PR and fix thank you so much.

lvl99wzrd commented 4 years ago

Temporary fix: set the version to 3.38

Vue.use(VueGoogleMaps, { load: { key: 'YOUR_API_KEY', libraries: 'places', v: 3.38 } })

garda-dafi commented 4 years ago

this is because of the method getPlace take all fields when place_changed event fired. Therefore the opening_hours.open_now and utc_offset would be included. You should specify the fields you gonna take, for example autocomplete.setFields(['geometry', 'formatted_address', 'name')

Here is my example code const self = this const inputSearchPlace = document.getElementById('inputSearchPlace') const inputSearchPlaceAutocomplete = new google.maps.places.Autocomplete(inputSearchPlace) inputSearchPlaceAutocomplete.setFields(['geometry', 'formatted_address', 'name']) inputSearchPlaceAutocomplete.addListener('place_changed', function() { self.placeDetail = inputSearchPlaceAutocomplete.getPlace() }

pnijsters commented 4 years ago

Just add 'fields' to the options passed to GmapAutocomplete... I only need the geometry (lat/lng) and don't need the rest of the fields in the response...

<GmapAutocomplete @place_changed="geolocateStart" :options="{fields: ['geometry']}"></GmapAutocomplete

coccoinomane commented 4 years ago

Just as @pnijsters said, using the options attribute did it for me.

Since I needed boh the geometry and the address components, I passe the attribute as :options="{fields: ['geometry', 'address_components']}".

albay13 commented 4 years ago

It seems that adding this :options="{fields:[]} attribute will help me with this sort of problem. Thank you, everyone.

k-sai-kiranmayee commented 4 years ago

Hello! Just a doubt though, when I set a location if no options are specified, then these are the values I get in the response, I couldn't find the opening_hours.open_now, am I missing anything? Kindly suggest if any... image