laravel-timezones
laravel-timezones copied to clipboard
different set and get timezone support
For global consistency, I believe it makes sense to support having the dates stored in one timezone and can be shown in any other timezone using the cast. While this is achievable via the ::set method on different cases and middleware, I think it would be more convenient to do it via the cast.
NB: I only took a glance at the codes, so I'm not 100% sure if this isn't already doable via the cast.
Ofc it can still be done by create a new cast that extends yours, but I think it would be better to have this within the package.
If you think this is feasible, I'm open to creating a PR
To be honest, I'm not entirely sure I understand what you're asking. Could you provide an example? Thanks!
So see it this way.
All timestamps are created with UTC, but when it's fetched, it should use the user's timezone.
Is this possible with the cast?
Yup, that's exactly what this package was built for 🙂
What doesn't work for you? Did you try to implement the example from the README?