Skip to content

Commit

Permalink
Merge pull request #30157 from nextcloud/fix/datepicker-share-lang
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Dec 10, 2021
2 parents 797184a + 3a4179d commit d851e58
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 27 deletions.
4 changes: 2 additions & 2 deletions apps/files_sharing/js/dist/files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/files_sharing/js/dist/files_sharing_tab.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion apps/files_sharing/src/components/SharingEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
}"
:class="{ error: errors.expireDate}"
:disabled="saving"
:first-day-of-week="firstDay"
:lang="lang"
:value="share.expireDate"
value-type="format"
Expand Down
3 changes: 1 addition & 2 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
}"
class="share-link-expire-date"
:disabled="saving"
:first-day-of-week="firstDay"

:lang="lang"
icon=""
type="date"
Expand Down Expand Up @@ -251,7 +251,6 @@
class="share-link-expire-date"
:class="{ error: errors.expireDate}"
:disabled="saving"
:first-day-of-week="firstDay"
:lang="lang"
:value="share.expireDate"
value-type="format"
Expand Down
36 changes: 15 additions & 21 deletions apps/files_sharing/src/mixins/SharesMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,24 @@ export default {
return moment().add(1, 'days')
},

/**
* Datepicker lang values
* https://github.com/nextcloud/nextcloud-vue/pull/146
* TODO: have this in vue-components
*
* @returns {int}
*/
firstDay() {
return window.firstDay
? window.firstDay
: 0 // sunday as default
},
// Datepicker language
lang() {
// fallback to default in case of unavailable data
const weekdaysShort = window.dayNamesShort
? window.dayNamesShort // provided by nextcloud
: ['Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.']
const monthsShort = window.monthNamesShort
? window.monthNamesShort // provided by nextcloud
: ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.']
const firstDayOfWeek = window.firstDay ? window.firstDay : 0

return {
days: window.dayNamesShort
? window.dayNamesShort // provided by nextcloud
: ['Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'],
months: window.monthNamesShort
? window.monthNamesShort // provided by nextcloud
: ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'],
placeholder: {
date: 'Select Date', // TODO: Translate
formatLocale: {
firstDayOfWeek,
monthsShort,
weekdaysMin: weekdaysShort,
weekdaysShort,
},
monthFormat: 'MMM',
}
},

Expand Down

0 comments on commit d851e58

Please sign in to comment.