mojotech / torch

A rapid admin generator for Elixir & Phoenix
Other
1.12k stars 80 forks source link

Date filters are altered after applying filter #241

Closed samcdavid closed 3 years ago

samcdavid commented 3 years ago

What I am doing

On a generated index page, when I have a date filter, if I set the start and end date filters and click the search button, when the page loads, both the start and end dates are one day prior to the value that was previously set.

For example: I set start date to 2021-06-16 and end date to 2021-06-17. After clicking the search button, the start date is 2021-06-15 and the end date is 2021-06-16.

Versions

Torch: ~> 3.6 deps/torch/mix.exs says the exact version is 3.6.1 Elixir: 1.12.0 Erlang: 24.0.1

cpjolicoeur commented 3 years ago

@samcdavid I'm not sure I'm seeing the issue you are referring to. Do you have a minimal setup test case you can point me to? Maybe a sample base repo that is exhibiting the behavior you are describing?

samcdavid commented 3 years ago

@cpjolicoeur sorry for the delay. Things over here have been hectic lately. Here is a link to the repo: https://github.com/samcdavid/torch_demo

This is a freshly generated phoenix project. The only changes that have been made are to install torch 3.6.1, use torch to generate a Blog context and Post model with title:string body:text publish_at:utc_datetime.

If you fire this up locally. Just set a start date and end date for publish at and you'll be able to recreate what I am seeing in that the dates move back one day after applying the filter.

cpjolicoeur commented 3 years ago

@samcdavid Can I ask what your timezone/locale is set to? It appears that the Pikaday.js library we use is not handling timezones properly when it initializes on datepicker fields. I'll look into a fix.

samcdavid commented 3 years ago

For my system, I am using the date, time, and timezone that apple is detecting, which is Eastern Daylight Time

cpjolicoeur commented 3 years ago

Thanks. Just wanted to confirm you weren't using UTC. I'll take a look at a fix for this. We'll have to patch the Pikaday lib a a bit I think.

cpjolicoeur commented 3 years ago

@samcdavid Any chance you can pull from this branch cpj/bug_issue_241 in your mix.exs to test the fix there before I merge it and cut an official release?

Would just love to get another set of eyes, and have you confirm this fixes the issue you are seeing before I release.

samcdavid commented 3 years ago

I'm still seeing the behavior.

cpjolicoeur commented 3 years ago

Just to confirm, you are seeing the behavior even after updating your mix.exs file to pull directly from this torch branch. I still see {:torch, "3.6.1"} in the demo repo you linked to earlier.

samcdavid commented 3 years ago

Yeah, sorry I didn't push that one up. I have {:torch, github: "mojotech/torch", branch: "cpj/bug_issue_241"} in my mix.exs.

samcdavid commented 3 years ago

@cpjolicoeur I just tested it again and it is fixed. 🤦‍♂️ Before I had just refreshed a tab that I already had open. When tested appropriately, it actually works. My apologies.

cpjolicoeur commented 3 years ago

@samcdavid ahh, thanks for confirming. I'll merge and cut a new official release and comment back here when it's ready.

Thanks for the report and help on this 👍

cpjolicoeur commented 3 years ago

@samcdavid Version 3.6.3 was released just now.

Thanks again for the help.