From 2b4ce7b95d6c009695d7f2ea02da424b538807a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?John=20Molakvo=C3=A6?= Date: Wed, 16 Nov 2022 12:19:35 +0100 Subject: [PATCH] Fix date handling and saving MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- .../src/components/SharingEntry.vue | 12 ++--- .../src/components/SharingEntryLink.vue | 50 +++++++++++-------- apps/files_sharing/src/mixins/SharesMixin.js | 41 ++++++++++++--- apps/files_sharing/src/models/Share.js | 4 +- dist/files_sharing-files_sharing_tab.js | 4 +- dist/files_sharing-files_sharing_tab.js.map | 2 +- 6 files changed, 72 insertions(+), 41 deletions(-) diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue index 7cc283e705c..932f65c20b2 100644 --- a/apps/files_sharing/src/components/SharingEntry.vue +++ b/apps/files_sharing/src/components/SharingEntry.vue @@ -99,7 +99,7 @@ :hide-label="true" :class="{ error: errors.expireDate}" :disabled="saving" - :value="share.expireDate" + :value="new Date(share.expireDate)" type="date" :min="dateTomorrow" :max="dateMaxEnforced" @@ -149,7 +149,7 @@ import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput' import NcActionTextEditable from '@nextcloud/vue/dist/Components/NcActionTextEditable' import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip' -import SharesMixin from '../mixins/SharesMixin' +import SharesMixin from '../mixins/SharesMixin.js' export default { name: 'SharingEntry', @@ -374,12 +374,10 @@ export default { return this.config.isDefaultInternalExpireDateEnforced || !!this.share.expireDate }, set(enabled) { - let defaultExpirationDate = this.config.defaultInternalExpirationDate - if (!defaultExpirationDate) { - defaultExpirationDate = new Date() - } + const defaultExpirationDate = this.config.defaultInternalExpirationDate + || new Date(new Date().setDate(new Date().getDate() + 1)) this.share.expireDate = enabled - ? defaultExpirationDate + ? this.formatDateToString(defaultExpirationDate) : '' console.debug('Expiration date status', enabled, this.share.expireDate) }, diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue index e1118e680c0..207db7d8514 100644 --- a/apps/files_sharing/src/components/SharingEntryLink.vue +++ b/apps/files_sharing/src/components/SharingEntryLink.vue @@ -97,14 +97,15 @@ {{ t('files_sharing', 'Expiration date (enforced)') }}