wireui / wireui

TallStack UI components
https://v1.wireui.dev
MIT License
1.37k stars 166 forks source link

Date picker and timezone #32

Closed trippo closed 2 years ago

trippo commented 2 years ago

There is another problem: I'm in Rome(UTC+2) timezone and if I pass "2021-06-16 19:50:00" to DateTime picker I see on the frontend

16/06/2021 17:50

with these params

display-format="DD/MM/YYYY HH:mm" parse-format="YYYY-MM-DD hh:mm:ss" and with or without without-timezone

122909442-7bf0ed80-d355-11eb-9b8f-7efb66e58275

PH7-Jack commented 2 years ago

Can check it again? What's your alpine version?

trippo commented 2 years ago

Alpine: 3.2.1 I think because the field is cast to a Carbon I think when you implement carbon type this issue will be resolve

diazsasak commented 2 years ago

@trippo i got the same bug. how you resolve the issue?

visoftdev commented 2 years ago

@trippo i got the same bug. how you resolve the issue?

use timezone="UTC" in datetime picker and Carbon::parse($value)->timezone(Config::get('app.timezone'));

PH7-Jack commented 2 years ago

@diazsasak @visoftdev pass the user-timezone and the system timezone <x-datetime-picker :timezone="$timezone" :user-timezone="$userTimezone" ... />

The user timezone is the navigator timezone by default The System Timezone is UTC by default

visoftdev commented 2 years ago

I use in blade:

<x-datetime-picker label="Thời gian" timezone="UTC" time-format=24 interval=30 class="my-2" placeholder="Chọn thời gian" wire:model="datetime" />

in component:

$date = Carbon::parse($this->datetime)->timezone(Config::get('app.timezone'));

It worked!

Thanks

trippo commented 2 years ago

I used timezone="UTC" user-timezone="UTC" and carbon with default config ('Europe/Rome')

baoanhng commented 1 year ago

Why close, this hasn't been resolved. The problem is we have to manually adjust the timezone instead of using what Carbon has already provided.