You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**This can lead to unexpected behavior** because the assigned Carbon instance will default to the `UTC` timezone, wheras the provided value was probably meant for another timezone. The datetime string will be stored as-is without shifting its timezone accordingly first.
107
+
108
+
In order to prevent this, it is recommended to let the Cast do the heavy lifting:
109
+
110
+
```php
111
+
$model->published_at = $request->published_at;
112
+
```
113
+
114
+
The package will now treat the provided datetime string using the correct Timezone (for instance, `Europe/Brussels`) and store the shifted `UTC` value in the database correctly.
115
+
116
+
A more verbose (but also correct) method would be to create the Carbon instance using the `Timezone` facade :
**This is not a bug**, it is intended behavior since one should be fully aware of the Carbon instance's timezone before assigning it.
125
+
97
126
## 🔥 Sponsorships
98
127
99
128
If you are reliant on this package in your production applications, consider [sponsoring us](https://github.com/sponsors/whitecube)! It is the best way to help us keep doing what we love to do: making great open source software.
0 commit comments