Skip to content

Commit 93144a6

Browse files
OpusCapita#60 Start week from sunday for "en" locale (OpusCapita#61)
Subscribe to this issue to remove ternary operators after it will be fixed iamkun/dayjs#215 Bugfixes ===== Start week from sunday for "en" locale
1 parent 9cc8392 commit 93144a6

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/client/components/DateInput/DateInput.DOCUMENTATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Based on configured to OpusCapita defaults [react-day-picker](https://github.com
3939
<DateInput
4040
value={_scope.state.value}
4141
dateFormat="dd/MM/yyyy"
42-
disabled={true}
42+
disabled={false}
4343
locale="en"
4444
onChange={_scope.handleChange}
4545
/>

src/client/components/DateRangeInput/DateRangeInput.react.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,35 @@ let defaultProps = {
6565
variants: [
6666
{
6767
getLabel: (locale) => getMessage(locale, 'previousWeek'),
68-
getValue: (locale) => [
68+
// TODO remove ternary operator below. Monitor this issue: https://github.com/iamkun/dayjs/issues/215
69+
getValue: (locale) => locale === 'en' ? [
6970
dayjs().locale(locale).subtract(7, 'days').startOf('week').toDate(),
7071
dayjs().locale(locale).subtract(7, 'days').endOf('week').toDate()
72+
] : [
73+
dayjs().locale(locale).subtract(7, 'days').startOf('week').add(1, 'day').toDate(),
74+
dayjs().locale(locale).subtract(7, 'days').endOf('week').add(1, 'day').toDate()
7175
]
7276
},
7377
{
7478
getLabel: (locale) => getMessage(locale, 'thisWeek'),
75-
getValue: (locale) => [
79+
// TODO remove ternary operator below. Monitor this issue: https://github.com/iamkun/dayjs/issues/215
80+
getValue: (locale) => locale === 'en' ? [
7681
dayjs().locale(locale).startOf('week').toDate(),
7782
dayjs().locale(locale).endOf('week').toDate()
83+
] : [
84+
dayjs().locale(locale).startOf('week').add(1, 'day').toDate(),
85+
dayjs().locale(locale).endOf('week').add(1, 'day').toDate()
7886
]
7987
},
8088
{
8189
getLabel: (locale) => getMessage(locale, 'nextWeek'),
82-
getValue: (locale) => [
90+
// TODO remove ternary operator below. Monitor this issue: https://github.com/iamkun/dayjs/issues/215
91+
getValue: (locale) => locale === 'en' ? [
8392
dayjs().locale(locale).add(7, 'days').startOf('week').toDate(),
8493
dayjs().locale(locale).add(7, 'days').endOf('week').toDate()
94+
] : [
95+
dayjs().locale(locale).add(7, 'days').startOf('week').add(1, 'day').toDate(),
96+
dayjs().locale(locale).add(7, 'days').endOf('week').add(1, 'day').toDate()
8597
]
8698
},
8799
{

src/client/components/DayPicker/DayPicker.react.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class DayPicker extends Component {
180180
className={pickerClassName}
181181
localeUtils={localeUtils}
182182
locale={locale}
183+
firstDayOfWeek={locale === 'en' ? 0 : 1}
183184
onDayClick={this.handleDateChange}
184185
onDayKeyDown={this.handleDateChange}
185186
onDayTouchEnd={this.handleDateChange}

0 commit comments

Comments
 (0)