Commit 36051b9a authored by Clement Ho's avatar Clement Ho

Merge branch '58023-add-Saturday-to-localization-first-day-of-the-week' into 'master'

Resolve "Add Saturday to Localization first day of the week"

Closes #58023

See merge request gitlab-org/gitlab-ce!25509
parents c32dccfd cf4bbd4f
......@@ -10,6 +10,12 @@ import { __ } from '~/locale';
const d3 = { select, scaleLinear, scaleThreshold };
const firstDayOfWeekChoices = Object.freeze({
sunday: 0,
monday: 1,
saturday: 6,
});
const LOADING_HTML = `
<div class="text-center">
<i class="fa fa-spinner fa-spin user-calendar-activities-loading"></i>
......@@ -49,7 +55,7 @@ export default class ActivityCalendar {
timestamps,
calendarActivitiesPath,
utcOffset = 0,
firstDayOfWeek = 0,
firstDayOfWeek = firstDayOfWeekChoices.sunday,
monthsAgo = 12,
) {
this.calendarActivitiesPath = calendarActivitiesPath;
......@@ -206,11 +212,16 @@ export default class ActivityCalendar {
},
];
if (this.firstDayOfWeek === 1) {
if (this.firstDayOfWeek === firstDayOfWeekChoices.monday) {
days.push({
text: 'S',
y: 29 + this.dayYPos(7),
});
} else if (this.firstDayOfWeek === firstDayOfWeekChoices.saturday) {
days.push({
text: 'S',
y: 29 + this.dayYPos(6),
});
}
this.svg
......
......@@ -46,7 +46,8 @@ module PreferencesHelper
def first_day_of_week_choices
[
[_('Sunday'), 0],
[_('Monday'), 1]
[_('Monday'), 1],
[_('Saturday'), 6]
]
end
......
---
title: Add Saturday to Localization first day of the week
merge_request: 25509
author: Ahmad Haghighi
type: added
......@@ -161,7 +161,7 @@ are listed in the descriptions of the relevant settings.
| `email_author_in_body` | boolean | no | Some email servers do not support overriding the email sender name. Enable this option to include the name of the author of the issue, merge request or comment in the email body instead. |
| `enabled_git_access_protocol` | string | no | Enabled protocols for Git access. Allowed values are: `ssh`, `http`, and `nil` to allow both protocols. |
| `enforce_terms` | boolean | no | (**If enabled, requires:** `terms`) Enforce application ToS to all users. |
| `first_day_of_week` | integer | no | Start day of the week for calendar views and date pickers. Valid values are `0` (default) for Sunday and `1` for Monday. |
| `first_day_of_week` | integer | no | Start day of the week for calendar views and date pickers. Valid values are `0` (default) for Sunday, `1` for Monday, and `6` for Saturday. |
| `gitaly_timeout_default` | integer | no | Default Gitaly timeout, in seconds. This timeout is not enforced for git fetch/push operations or Sidekiq jobs. Set to `0` to disable timeouts. |
| `gitaly_timeout_fast` | integer | no | Gitaly fast operation timeout, in seconds. Some Gitaly operations are expected to be fast. If they exceed this threshold, there may be a problem with a storage shard and 'failing fast' can help maintain the stability of the GitLab instance. Set to `0` to disable timeouts. |
| `gitaly_timeout_medium` | integer | no | Medium Gitaly timeout, in seconds. This should be a value between the Fast and the Default timeout. Set to `0` to disable timeouts. |
......
......@@ -103,4 +103,10 @@ Select your preferred language from a list of supported languages.
The first day of the week can be customised for calendar views and date pickers.
You can choose **Sunday** or **Monday** as the first day of the week. If you select **System Default**, the system-wide default setting will be used.
You can choose one of the following options as the first day of the week:
- Saturday
- Sunday
- Monday
If you select **System Default**, the system-wide default setting will be used.
......@@ -6515,6 +6515,9 @@ msgstr ""
msgid "SSL Verification"
msgstr ""
msgid "Saturday"
msgstr ""
msgid "Save"
msgstr ""
......
......@@ -36,10 +36,11 @@ describe PreferencesHelper do
end
describe '#first_day_of_week_choices' do
it 'returns Sunday and Monday as choices' do
it 'returns Saturday, Sunday and Monday as choices' do
expect(helper.first_day_of_week_choices).to eq [
['Sunday', 0],
['Monday', 1]
['Monday', 1],
['Saturday', 6]
]
end
end
......@@ -47,14 +48,21 @@ describe PreferencesHelper do
describe '#first_day_of_week_choices_with_default' do
it 'returns choices including system default' do
expect(helper.first_day_of_week_choices_with_default).to eq [
['System default (Sunday)', nil], ['Sunday', 0], ['Monday', 1]
['System default (Sunday)', nil], ['Sunday', 0], ['Monday', 1], ['Saturday', 6]
]
end
it 'returns choices including system default set to Monday' do
stub_application_setting(first_day_of_week: 1)
expect(helper.first_day_of_week_choices_with_default).to eq [
['System default (Monday)', nil], ['Sunday', 0], ['Monday', 1]
['System default (Monday)', nil], ['Sunday', 0], ['Monday', 1], ['Saturday', 6]
]
end
it 'returns choices including system default set to Saturday' do
stub_application_setting(first_day_of_week: 6)
expect(helper.first_day_of_week_choices_with_default).to eq [
['System default (Saturday)', nil], ['Sunday', 0], ['Monday', 1], ['Saturday', 6]
]
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment