jamesmills / laravel-timezone

Enable user Timezones in your application.
MIT License
675 stars 89 forks source link

UpdateUsersTimezone gives wrong info #52

Closed AEK-BKF closed 2 years ago

AEK-BKF commented 3 years ago

Hi,

Thanks for this nice package, I've integrated it on live server, and I'm using ipgeolocation service in geoip package config. So, I found this bug here :

if (config('timezone.overwrite') == true || $user->timezone == null) {
                $user->timezone = $geoip_info['timezone'];
                $user->save();
                $this->notify($geoip_info);
 }

This : $geoip_info['timezone'] returns Null Here dd($geoip_info) (See Attached) So to fix it : ` $user->timezone = $geoip_info->time_zone['name'];

bug `

Thanks.

jamesmills commented 3 years ago

Hi @AEK-BKF

Ahhhh, OK. I understand. I thought that torann/geoip would standardize the returned data so we wouldn't see this issue.

I guess we could put something like

$user->timezone = $geoip_info['timezone'] ?? $geoip_info->time_zone['name'];

If you can test and submit a PR for this I will accept it, thanks.

jamesmills commented 3 years ago

@AEK-BKF are you still having this issue? Any chance you could PR the solution?

maher1337 commented 2 years ago

Hey @jamesmills I created a PR https://github.com/jamesmills/laravel-timezone/pull/76