diegopvlk / Dosage

Medication tracker for Linux
GNU General Public License v3.0
84 stars 15 forks source link

Weeks does not start with Sunday in Turkish #40

Closed ghost closed 4 months ago

ghost commented 8 months ago

In Turkish and some other countries, the first day of the week is Monday (meaning Pazartesi).

GNOME Calendar uses the correct format for this.

Image

On the other hand, Dosage starts the week from Monday.

Week

You may check the following article for more information: https://www.timeanddate.com/calendar/days/

diegopvlk commented 8 months ago

Can you test it?

ghost commented 8 months ago

Thanks. Fixed.

diegopvlk commented 7 months ago

Is this still working? When I run with the LC_ALL=tr_TR I still get Sunday as the first day

ghost commented 7 months ago

Seems broken now. Ekran Görüntüsü - 2024-01-29 23-01-17

diegopvlk commented 7 months ago

Yeah, I have no idea how to reliably get the first day of the week. If you know how, please let me know.

ghost commented 7 months ago

I see two examples that seems the same or similar.

https://gitlab.gnome.org/GNOME/gnome-calendar/-/blob/main/src/utils/gcal-utils.c?ref_type=heads#L330-387

https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/main/src/shell-util.c?ref_type=heads#L79-135

ghost commented 7 months ago

From Evolution

Ekran Görüntüsü - 2024-01-30 00-24-37

diegopvlk commented 7 months ago

I understand very little of this code. The calculation seems to be correct (I think..)

The problem is figuring it out the week number of the current locale (I'm using 1, October 2000) this day for me is on week 40, for you it should be week 39.

It's always gives 40 as the result now, before it gave 39 when I changed the locale, I didn't change anything in the code and somehow it stopped working so ¯_(ツ)_/¯

ghost commented 7 months ago

Could you use different date. E.g: 1, October 2017. Turkish timezone and daylight saving changed around 2016.

erklyn commented 7 months ago

I could try to tackle this.

diegopvlk commented 7 months ago

Could you use different date. E.g: 1, October 2017. Turkish timezone and daylight saving changed around 2016.

Doesn't seem to make a difference.

I could try to tackle this.

@erklyn That's the function: https://github.com/diegopvlk/Dosage/blob/66b505db40431d988ed25f3499c4e765310ff28e/src/utils.js#L15-L24

If you manage to fix it, please open a PR.

Also make sure to backup your data before running the latest commit, I change some stuff and I didn't test everything properly yet, so it may cause some data loss.

erklyn commented 7 months ago

@diegopvlk looks fine and works fine on my system as well, returns 39 for me I am an in Turkey so works correctly.

there might be an issue on the button part. I'll take a look as soon as possible and post a pr.

diegopvlk commented 7 months ago

@erklyn It's not the button, you can test it by just returning false instead.

What's your output of locale?

diegopvlk commented 4 months ago

Turns out there is a very simple command to check the first weekday: locale first_weekday 🤦‍♂️