Commit 0c215e38 authored by Clement Ho's avatar Clement Ho

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

EE Port: Add Saturday to first day of the week

Closes gitlab-ce#58023

See merge request gitlab-org/gitlab-ee!9797
parents 3fc64000 8c644dcd
......@@ -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
......
......@@ -186,7 +186,7 @@ are listed in the descriptions of the relevant settings.
| `external_authorization_service_timeout` | float | required by: `external_authorization_service_enabled` | **(Premium)** The timeout after which an authorization request is aborted, in seconds. When a request times out, access is denied to the user. (min: 0.001, max: 10, step: 0.001) |
| `external_authorization_service_url` | string | required by: `external_authorization_service_enabled` | **(Premium)** URL to which authorization requests will be directed |
| `file_template_project_id` | integer | no | **(Premium)** The ID of a project to load custom file templates from |
| `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. |
| `geo_status_timeout` | integer | no | **(Premium)** The amount of seconds after which a request to get a secondary node status will time out. |
| `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. |
......
......@@ -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.
......@@ -8519,6 +8519,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