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

Daylight savings (CET vs CEST?)

Open avonian opened this issue 4 years ago • 3 comments

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?

avonian avatar Mar 16 '21 11:03 avonian

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')

jamesmills avatar Mar 17 '21 08:03 jamesmills

Hi james, thanks so much for the reply.

Here's what I've got:

  • {{ Carbon\Carbon::now()->format('jS F Y g:i:a e T') }} 17th March 2021 2:11:pm US/Eastern EDT
  • {{ $event->event_date->format('jS F Y g:i:a e T') }} 24th April 2021 11:00:am US/Eastern EDT
  • @displayDate($event->start_date, 'jS F Y g:i:a e T') 24th April 2021 5:00:pm Europe/Madrid CEST

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

avonian avatar Mar 17 '21 18:03 avonian

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

jamesmills avatar Mar 18 '21 03:03 jamesmills