GithubHelp home page GithubHelp logo

Comments (14)

 avatar commented on July 26, 2024 1

Thanks. Fixed.

from dosage.

diegopvlk avatar diegopvlk commented on July 26, 2024

Can you test it?

from dosage.

diegopvlk avatar diegopvlk commented on July 26, 2024

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

from dosage.

 avatar commented on July 26, 2024

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

from dosage.

diegopvlk avatar diegopvlk commented on July 26, 2024

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

from dosage.

 avatar commented on July 26, 2024

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

from dosage.

 avatar commented on July 26, 2024

From Evolution

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

from dosage.

diegopvlk avatar diegopvlk commented on July 26, 2024

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 ¯_(ツ)_/¯

from dosage.

 avatar commented on July 26, 2024

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

from dosage.

erklyn avatar erklyn commented on July 26, 2024

I could try to tackle this.

from dosage.

diegopvlk avatar diegopvlk commented on July 26, 2024

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:

Dosage/src/utils.js

Lines 15 to 24 in 66b505d

function weekStartsMonday() {
const date = new Date(2000, 9, 0);
const startOfYear = new Date(2000, 0, 1);
const dayOfYear = Math.floor((date - startOfYear) / 86400000) + 1;
const weekNumber = Math.ceil(dayOfYear / 7);
// 39 = starts on monday
// 40 = starts on sunday
return weekNumber === 39;
}

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.

from dosage.

erklyn avatar erklyn commented on July 26, 2024

@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.

from dosage.

diegopvlk avatar diegopvlk commented on July 26, 2024

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

What's your output of locale?

from dosage.

diegopvlk avatar diegopvlk commented on July 26, 2024

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

from dosage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.