@kuns25 One thing I can tell you is in order to support multiple timezones you should 100% keep your config/app.php timezone setting to UTC.
I would also strongly suggest giving the user the ability to select and change their own timezone setting and persist this to the users table in the database. If you are using Vue, you can pull in moment and moment-timezone to build out a cool selector component on sign up that guesses the users current timezone like so...
<template>
<select name="timezone" id="timezone" class="form-control" required>
<option
v-for="timezone in JSON.parse(timezones)"
:key="timezone"
:value="timezone"
:selected="timezone == tzGuess"
>
{{ timezone }}
</option>
</select>
</template>
<script>
import moment from 'moment';
require('moment-timezone');
export default {
props: ['timezones'],
computed: {
tzGuess() {
return moment.tz.guess(true);
}
}
}
</script>
<time-zone-select timezones="{{ json_encode(timezone_identifiers_list(), JSON_UNESCAPED_SLASHES) }}"></time-zone-select>
Then you essentially wind up just having to convert timezones on the way into and out of the database to and from UTC. The power of this is that UTC gives you a baseline to always convert from.
You can pass the timezone to moment like so...
var timezone = 'US/Central'; // Pass this through props or get from the database directly
moment.tz(timezone).format('dddd, MMMM Do YYYY, h:mm:ss a')
Then you can use Carbon to parse timezones in PHP as well... the user timezone in parse tells it to parse the passed time using the user's timezone, timezone('UTC') then converts that to UTC to use for a date range search or something programatically.
Carbon::parse($request->report_start, auth()->user()->timezone)
->startOfDay()
->timezone('UTC')
->toDateTimeString()
When storing time in the database, typically most date pickers are timezone aware and pass the converted UTC time, so you usually don't need to do anything. However, this is not guaranteed and you'll want to check everything when you implement new date pickers and such.
Final note. What you are trying to do above by switching the config timezone entirely is going to cause you massive headaches. I'd strongly advise against using that approach.