diff --git a/apps/files_sharing/js/dist/files_sharing_tab.js b/apps/files_sharing/js/dist/files_sharing_tab.js index b6b0d5c8e544c39aa620d386302806036141cfa9..01c95a303a2397a0a994f5a82717c48e08cf9566 100644 Binary files a/apps/files_sharing/js/dist/files_sharing_tab.js and b/apps/files_sharing/js/dist/files_sharing_tab.js differ diff --git a/apps/files_sharing/js/dist/files_sharing_tab.js.map b/apps/files_sharing/js/dist/files_sharing_tab.js.map index bab1e7e03a5285f23e6acf6d58d1de2595f62844..e3d70ca37d0199c78f651202e110142dc9549519 100644 Binary files a/apps/files_sharing/js/dist/files_sharing_tab.js.map and b/apps/files_sharing/js/dist/files_sharing_tab.js.map differ diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue index e3f7497181f429cf7fafe19c70b591e1ba34b7bc..288236abad72e484b1a05ca3bf1bbe850e080de5 100644 --- a/apps/files_sharing/src/components/SharingEntry.vue +++ b/apps/files_sharing/src/components/SharingEntry.vue @@ -95,8 +95,7 @@ value-type="format" icon="icon-calendar-dark" type="date" - :not-before="dateTomorrow" - :not-after="dateMaxEnforced" + :disabled-date="disabledDate" @update:value="onExpirationChange"> {{ t('files_sharing', 'Enter a date') }} </ActionInput> diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue index f8b8137cd291ff77f7a20f647d6e51919f41d4cd..e1722420a49190f1ceca8cc47fe8ca31478fa266 100644 --- a/apps/files_sharing/src/components/SharingEntryLink.vue +++ b/apps/files_sharing/src/components/SharingEntryLink.vue @@ -105,8 +105,7 @@ icon="" type="date" value-type="format" - :not-before="dateTomorrow" - :not-after="dateMaxEnforced"> + :disabled-date="disabledDate"> <!-- let's not submit when picked, the user might want to still edit or copy the password --> {{ t('files_sharing', 'Enter a date') }} @@ -231,8 +230,7 @@ value-type="format" icon="icon-calendar-dark" type="date" - :not-before="dateTomorrow" - :not-after="dateMaxEnforced" + :disabled-date="disabledDate" @update:value="onExpirationChange"> {{ t('files_sharing', 'Enter a date') }} </ActionInput> diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js index 8806209954af01c222fa9816a70f38d03908fdd4..e19af48bc7eed838c748cb78993eea8ae1a23021 100644 --- a/apps/files_sharing/src/mixins/SharesMixin.js +++ b/apps/files_sharing/src/mixins/SharesMixin.js @@ -300,5 +300,16 @@ export default { debounceQueueUpdate: debounce(function(property) { this.queueUpdate(property) }, 500), + + /** + * Returns which dates are disabled for the datepicker + * @param {Date} date date to check + * @returns {boolean} + */ + disabledDate(date) { + const dateMoment = moment(date) + return (this.dateTomorrow && dateMoment.isBefore(this.dateTomorrow, 'day')) + || (this.dateMaxEnforced && dateMoment.isSameOrAfter(this.dateMaxEnforced, 'day')) + }, }, }