Casvt / MIND

A simple self hosted reminder application that can send push notifications to your device. Set the reminder and forget about it!
https://casvt.github.io/MIND/
GNU General Public License v3.0
201 stars 10 forks source link

Off by one error on recurring days reminder? #64

Closed joestump closed 1 month ago

joestump commented 9 months ago

Description of the bug

When creating recurring reminders on specific days I'm seeing an off-by-one error when selecting days vs. what the reminder dashboard shows on save. If I select "Mo", on save it shows "Sun" after save on the dashboard.

To Reproduce

Expected behaviour

When I select "Mo"

Screenshots

You can see in this screen recording what I'm seeing with the "Test" reminder:

https://github.com/Casvt/MIND/assets/37667/e0bae87c-cb7d-4243-afd2-40b79d64bc9c

Version info

rossman-home commented 8 months ago

Can confirm this bug. Having the same problem. Tried to delete the reminder and readd, having the same issue. image image

Casvt commented 6 months ago

Do you have your locale settings set up in such way that Sunday is considered the first day of the week? Also, what is the locale you set in the settings of MIND?

rossman-home commented 6 months ago

Do you have your locale settings set up in such way that Sunday is considered the first day of the week? Also, what is the locale you set in the settings of MIND?

environment variable was correct, but the Mind settings were possibly the issue. I guess either I set it wrong or it defaulted to "en-gb". I updated it to "en-us" I'll test and see if it works for the entire week. Thanks!

Casvt commented 6 months ago

The default is en-GB yes. What I think is happening is that somewhere on your system (os? Browser? Docker?) a locale is used that considers Sunday to be the first day of the week instead of Monday. MIND doesn't handle that and, without getting too technical, that's why the set days are shifted by one; the beginning of the week is also shifted by one day.

rossman-home commented 6 months ago

The default is en-GB yes. What I think is happening is that somewhere on your system (os? Browser? Docker?) a locale is used that considers Sunday to be the first day of the week instead of Monday. MIND doesn't handle that and, without getting too technical, that's why the set days are shifted by one; the beginning of the week is also shifted by one day.

I changed the computer Mind is running on to start Monday, deleted DB and spun the container back up, did not fix. I tried Chrome, Opera, Firefox and Edge browsers on Windows after changing the date on my Windows machine and that did not work. I also tried Firefox on the Linux machine. All after removing the Mind container. Any other options I may be missing?

Casvt commented 6 months ago

Any other options I may be missing?

A bug in my software. I'm not sure what's going wrong yet, but it looks like it's a bug in my software then.

Casvt commented 6 months ago

@joestump, @rossman-home, Could one of you do something for me? I want to determine if the problem lays in the frontend or backend.

  1. Open the web-ui and log in.
  2. Press Ctrl + Shift + I to open the developer tab.
  3. Go to the Network tab (top right).
  4. Reload the page.
  5. A list of requests should pop up in the Network tab.
  6. Select the request made to /api/reminders (will look like reminders?api_key=... in the list).
  7. A side window should open when you click on the request, select the tab Preview.
  8. Open the results and in the list, search for a reminder that experiences the bug described in this issue.
  9. Share it's data and on which days it's supposed to trigger.

image

Note: the value of the weekdays key will look different for you than you see in the image, don't worry about that.

In the image you can see that I've opened the red "Test1" reminder in the results in the Preview tab. It says for the weekdays [1, 3] (for you "1,3") and in the UI you can see that it says for the days Tue and Thu (which is correct).

Casvt commented 5 months ago

@joestump @rossman-home please see my previous comment

jdobbs commented 4 months ago

I'm pretty sure I'm having the same issue here. I create a reminder for Monday, April 8, 2024, at 8:00 AM (first screenshot). When I save it, it shows Monday, April 15, 2024, but for each Sunday (second screenshot). The third screenshot is the steps from your request to view the request in the browser.

My PC is on New York time (Eastern), the Docker host (Ubuntu 22.04) is on New York time, and I've set the TZ on the MIND Docker to New York. I verified time zones using a website that shows browser TZ on Ubuntu by running the timedatectl and date commands and within the docker by running "docker exec -it mind date".

I've tried Firefox, Edge, and Chrome, and I've also tried private/incognito tabs in each.

I'm the image: mrcas/mind:latest image.

image

image

image

jdobbs commented 4 months ago

Just as another test, I manually deployed to a Windows host using localhost:8080. I get the same issue: a repeating reminder for Monday, April 8, 2024, at 8:00 AM saves as Monday, April 15, 2024, at 8:00 AM but says Each Sunday.

Casvt commented 4 months ago

Thanks for doing the browser thing. Based on the screenshot, I can say that the wrong weekday is purely in the browser and the actual reminder will run on Monday. On my PC, day 0 converts to Monday, but in your screenshot, day 0 converts to Sunday.

So it's purely the browser converting the day of the week wrong (it sees Sunday as the first day of the week). Probably something with localisation.

And I think I found the problem of the first trigger being one week later.