aesmail / kaffy

Powerfully simple admin package for phoenix applications
https://kaffy.fly.dev/admin/
MIT License
1.3k stars 153 forks source link

[BUG] Problems with :utc_datetime #269

Closed ferigis closed 10 months ago

ferigis commented 1 year ago

Versions Used Kaffy: 0.9.4 Phoenix: 1.7.0 Elixir: 1.14.3

What's actually happening?

I have a field in the database called start_date with :utc_datetime type. When I want to create a new entity from the Kaffy's dashboard I select the datetime and it sends to the backend "2023-04-21 19:00:00" which is ok. I want that to reflect "2023-04-21 19:00:00" in utc. It ends storing "2023-04-21 19:00:00Z" in the DB. Which is the expected result.

If now I want to edit it (on Kaffy's dashboard) it shows the datepicker with the value "2023-04-21 13:00:00" which is wrong, that value is the "2023-04-21 19:00:00" UTC but in my current timezone, so if I click save it will send "2023-04-21 13:00:00" to the backend ending with "2023-04-21 13:00:00Z" stored on the DB. Which is wrong.

What should happen instead?

The datepicker must show the exact value from the DB, not converting it to my local timezone.

aesmail commented 10 months ago

@ferigis thank you for this issue. It's a pretty serious issue. It's been fixed and a release will be published soon.