miharekar / visualizer

A visualizer for .shot files
https://visualizer.coffee/
MIT License
97 stars 11 forks source link

Bag roast date not taking into account different date formats #111

Closed aarongoldenthal closed 4 weeks ago

aarongoldenthal commented 1 month ago

Describe the bug

I have the date format setting for the DYE extension set to MDY. My most recent bag is entered as 09.02.2024 (i.e. September 2, 2024), and the extension is interpreting it correctly since it says is 19 days off roast. The visualizer, on the shot and roasters pages, now displays the roast date, but it's showing as February 09, 2024. So, if the date parses it's incorrect, but many dates will fail to parse properly.

To Reproduce Steps to reproduce the behavior:

  1. Enter bag roast date with the DYE extensions set to MDY (and maybe anything other than DMY, I did not check) and upload a shot
  2. Check the date displayed for the shot

Expected behavior

The date format should be taken into account when parsing dates.

Desktop (please complete the following information):

miharekar commented 1 month ago

Ah, interesting. Need to look into how DYE handles this and if there's a way for me to detect which one it is πŸ€”

miharekar commented 1 month ago

Just checked with @ebengoechea and:

…the setting to format it as the user wants is a DYE setting, not a global setting you can find in the file

I think the app would handle dates with numbers larger than 12 on the second position automatically, but it can't determine what "09.02.2024" stands for since it's ambiguous. It assumes it's not MDY since, as far as I know, that's only used in 1 out of 195 countries in the world πŸ˜‚

I will need to add a setting for this I believe. Similar to Fahrenheit. Huh, maybe I could even use that, since that's also not used much outside of USA. πŸ˜…

aarongoldenthal commented 1 month ago

I think the app would handle dates with numbers larger than 12 on the second position automatically, but it can't determine what "09.02.2024" stands for since it's ambiguous. It assumes it's not MDY since, as far as I know, that's only used in 1 out of 195 countries in the world πŸ˜‚

True, but it is the first option πŸ˜‰. Obviously an easy fix is just to change formats, which is what I'm going to do for now.

FYI - Changing the bag date first in the visualizer updated everything, that's really nice, and then the next shot (now DMY) synced with the previous bag by date.

I will need to add a setting for this I believe. Similar to Fahrenheit. Huh, maybe I could even use that, since that's also not used much outside of USA. πŸ˜…

Is it weird that I use US date format and Celsius 🀣.

miharekar commented 4 weeks ago

There is now an option in profile settings to set a date format. Let me know if it works correctly from then on πŸ˜…

aarongoldenthal commented 4 weeks ago

Thanks @miharekar.

I had previously just left the date in DYE as dd-mm-yyyy. When I changed the setting in visualizer (to mm-dd-yyyy), without uploading a new shot, the data for the latest bag in Roasters displayed the correct date, but all of the shots from that bag changed from 01-Oct to 10-Jan. Then I changed the DYE setting and thought the next upload might clean things up (last time I thought it did, but maybe I manually did, not sure), but the new shot shows the correct date (01-Oct), as does the bag, but the previous shots on this bag all show 10-Jan. If I change the setting back to dd-mm-yyyy, the dates for the shots swap, but the bag is still correct.

The previous bags and shots did not change with the setting change.

miharekar commented 3 weeks ago

I didn't update existing shots, because dates in them were already parsed (DMY) in case you use coffee management but not parsed if you don't. And I assumed people with this issue already fixed it on Visualizer. But maybe some didn't. So no matter what I did there'd be issues. So I opted to do it in a way where it would be correct from now on and resolve on case-by-case basis.

According to this issue, you changed it yourself πŸ˜…

FYI - Changing the bag date first in the visualizer updated everything, that's really nice, and then the next shot (now DMY) synced with the previous bag by date.

So I suggest you change it to what you want on DYE and have then update to the same setting on Visualizer. Then, on tablet in DYE, download last shot, which should update the date value to the current format on Visualizer and DYE, so your next shot should have the correct date set.

Let me know how it goes!

ebengoechea commented 3 weeks ago

I think the input date format should be saved in the app settings (now it's on DYE settings, so not stored in shot files) to avoid this problem. Let me ask John if that's ok for him and if it is, I will add it. That way it can be parsed and used by visualizer for new shots.

aarongoldenthal commented 3 weeks ago

@miharekar Thanks, that worked