laravel-timezone icon indicating copy to clipboard operation
laravel-timezone copied to clipboard

Add timezone select to Jetstream profile page?

Open seabasss opened this issue 4 years ago • 1 comments

Is there any way to add a timezone select to the Jetstream profile page? I only want to set timezone automatically when the user first log in and then let them change it under profile settings.

Has anyone built a select like that? I tried to add one, but quickly added up deep in laravel/jetstream core folders and figured I better ask here first.

Thanks!

seabasss avatar Aug 14 '21 16:08 seabasss

@seabasss I've done this by:

First edit the component for user profile: resources/views/profile/update-profile-information-form.blade.php

Add a select here with a list of timezones. You can get a timezone list using listidentifiers

Then allow the timezone input in app/Actions/Fortify/UpdateUserProfileInformation.php . You'll notice this is where the User model is updated, pass in the appropriate timezone value.

You'll want to add timezone to your user Model's $fillable if you resort to using the default $user->forceFill

Hope this helps.

sirmews avatar Sep 02 '21 09:09 sirmews