Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In some regions, monday is the first day of the week #6058

Open
mrvanes opened this issue Feb 13, 2019 · 17 comments
Open

In some regions, monday is the first day of the week #6058

mrvanes opened this issue Feb 13, 2019 · 17 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/enhancement An improvement of existing functionality type/upstream This is an issue in one of Gitea's dependencies and should be reported there

Comments

@mrvanes
Copy link

mrvanes commented Feb 13, 2019

Gitea version: 1.7.1, from single binary.
The high-level contribution overview starts the week at sunday. I'd prefer to make it start on monday and have sunday the bottom, as a feature-request.
image

@lafriks lafriks added the type/enhancement An improvement of existing functionality label Feb 13, 2019
@kolaente
Copy link
Member

kolaente commented Mar 8, 2019

I'd prefer to have this configurable when it gets implemented as the week starts in some countries on monday while in others on sunday.

@jolheiser
Copy link
Member

From me tinkering with this for a bit:

While the module we use allows us to change the order of the days of the week, the squares do not seem to change accordingly to match, which unfortunately means this feature may have to first happen upstream...

@stale
Copy link

stale bot commented May 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label May 7, 2019
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label May 8, 2019
@stale stale bot removed the issue/stale label May 8, 2019
@Oreolek
Copy link

Oreolek commented May 8, 2019

So this depends on julienr114/vue-calendar-heatmap#1 right?

@lunny lunny added the status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR label May 9, 2019
@kolaente
Copy link
Member

kolaente commented May 9, 2019

@Oreolek Yeah pretty much.

@MalcolmAnderson
Copy link

Is any work being done on this? +1

@mind-overflow
Copy link

any update?

@lafriks
Copy link
Member

lafriks commented Jul 18, 2020

This depends on upstream library to add such option so this should be asked in it

@lafriks lafriks added type/upstream This is an issue in one of Gitea's dependencies and should be reported there and removed status/blocked This PR cannot be merged yet, i.e. because it depends on another unmerged PR labels Jul 18, 2020
@noerw
Copy link
Member

noerw commented Dec 22, 2020

upstream reference with a PR: julienr114/vue-calendar-heatmap#14

@molaie
Copy link

molaie commented Sep 12, 2021

Any chance for this feature? our start days are saturdays

@rjc
Copy link

rjc commented Feb 17, 2022

I'd just like to point out that Monday being the first day of the week isn't just in some regions - it's international, as in ISO - the standards organization - not just ISO 8601. If anything, that should be the default and, if not, then configurable at the very least.

@mariuszmaximus
Copy link

I'm waiting

@jolheiser
Copy link
Member

I'm waiting

A PR would be great for this! 🙂

@bendem
Copy link

bendem commented Mar 14, 2023

Note that 04e97b8 changed the library to an updated one, I opened a new issue there: razorness/vue3-calendar-heatmap#19

@KazzmanK
Copy link
Contributor

KazzmanK commented May 7, 2023

Looks like heatmap control is abandoned one. There is a PR with fix, but still.
May be there is a reason to fork it and use updated version?

@Wohlstand
Copy link

In some regions

I'll clarify you: in MANY regions, the more than a half of countries in the world uses Monday as a start of week. Also the fact: Bandgladesh begins week with Friday, and seven countries (United Arabic Emirates, Bahrein, Jibuty, Algir, Egypt, Marokko, Sudan) do begin a week with a... Saturday!

@serious-angel
Copy link

serious-angel commented Jun 2, 2024

I see that the commit data (i.e. "commit count" per "date"):
- 1. Gets obtained from the database and is not localized;
- 2. Later, it gets rendered on the HTML;
- 3. Passed to Vue in "user timezone" with locale-translated calendar items.

In the library used, it gets iterated through based on the data and these date items Vue prop-passed, indicating the localized day name at index 1, and starting from date at index possibly disrespecting the passed locale at all.

Considering the latter, even if it's relatively possible to get the browser's locale using Intl and/or add a definite setting in Gitea User settings for the first day of the week, it feels like a change in the library is still required. Is that correct?

Intl works indeed with a quick test:

// https://github.com/go-gitea/gitea/blob/98a61040b1c83790b0e0e977188842f967ae357e/web_src/js/utils.js#L43
function getCurrentLocale() {
  return document.documentElement.lang ?? nvagiator.language;
}

// https://github.com/go-gitea/gitea/blob/98a61040b1c83790b0e0e977188842f967ae357e/web_src/js/utils.js#L53
function translateDay(day = 0, localeCode = null) {
  const _localeCode = localeCode ?? getCurrentLocale();
  const intlLocale = Intl?.Locale ? new Intl.Locale(_localeCode) : {};
  const firstDayIndex = intlLocale?.weekInfo?.firstDay ?? 0;
  console.log(_localeCode, intlLocale, firstDayIndex);
    
  return new Date(Date.UTC(2022, 7, (day + firstDayIndex) % 7)).toLocaleString(_localeCode, {
    weekday: 'short',
    timeZone: 'UTC'
  });
}

// E.g. for 'en-US'.
translateDay(0); // 'Sun'

// 'lt' - Lithuania.
translateDay(0, 'lt'); // 'pr'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/enhancement An improvement of existing functionality type/upstream This is an issue in one of Gitea's dependencies and should be reported there
Projects
None yet
Development

No branches or pull requests