jamesmills / laravel-timezone

Enable user Timezones in your application.
MIT License
677 stars 91 forks source link

Daylight savings (CET vs CEST?) #65

Open avonian opened 3 years ago

avonian commented 3 years ago

Hi there,

First off wonderful package thank you for your awesome contribution :)

I'm confused as to why @displayDate($event->event_date) is returning a time in CEST right now for a user in 'Europe/Paris' when we're not yet in CEST.

The date time on the environment is accurately showing March 16 2021, so not an env issue.

Is something that needs to be toggled manually?

jamesmills commented 3 years ago

Hi @avonian

Thank you for your kind comments. It's nice to know that people value the package and use it in the wild!

I can only assume that this is some issue with the server time.

Can you do this and see what results we get?

{{ Carbon::now()->format('jS F Y g:i:a e T') }}

{{ $event->event_date->format('jS F Y g:i:a e T') }}

@displayDate($event->event_date, 'jS F Y g:i:a e T')
avonian commented 3 years ago

Hi james, thanks so much for the reply.

Here's what I've got:

And the system date is set to Wed Mar 17 18:12:14 UTC 2021

jamesmills commented 3 years ago

Howdy!

Ok, so I've no clue! lol.

What is the timezone value set on the user? Because the the package just takes that and converts the event date to that timezone.

https://github.com/jamesmills/laravel-timezone/blob/c33628d6fc50c81c6ed885203327a5c3bc642de5/src/Timezone.php#L21-L23

So I'm not technically sure who/what decides when it's daylight saving or not. I assumed the system/php had some magic to work this out so I wouldn't have though this should be a problem.

Hummmmm