From 1eac730cafa99bf47924e0d70c43e0e2cf6d0455 Mon Sep 17 00:00:00 2001 From: "julia.kirschenheuter" Date: Tue, 6 Sep 2022 12:43:50 +0200 Subject: [PATCH] Replace moment.js date with Date Object. Replace vue2-datepicker with native date picker for expiration date. Signed-off-by: julia.kirschenheuter Signed-off-by: nextcloud-command --- .../src/components/SharingEntry.vue | 32 +++++------- .../src/components/SharingEntryLink.vue | 47 +++++++---------- apps/files_sharing/src/mixins/SharesMixin.js | 26 ++-------- apps/files_sharing/src/models/Share.js | 9 ++-- .../src/services/ConfigService.js | 51 +++++++++---------- dist/files_sharing-files_sharing_tab.js | 4 +- dist/files_sharing-files_sharing_tab.js.map | 2 +- 7 files changed, 68 insertions(+), 103 deletions(-) diff --git a/apps/files_sharing/src/components/SharingEntry.vue b/apps/files_sharing/src/components/SharingEntry.vue index fccabf4532b0d..9627f2d77c522 100644 --- a/apps/files_sharing/src/components/SharingEntry.vue +++ b/apps/files_sharing/src/components/SharingEntry.vue @@ -95,20 +95,15 @@ + :min="dateTomorrow" + :max="dateMaxEnforced" + @input="onExpirationChange"> {{ t('files_sharing', 'Enter a date') }} @@ -380,21 +375,20 @@ export default { }, set(enabled) { this.share.expireDate = enabled - ? this.config.defaultInternalExpirationDateString !== '' - ? this.config.defaultInternalExpirationDateString - : moment().format('YYYY-MM-DD') + ? this.config.defaultInternalExpirationDate !== '' + ? this.config.defaultInternalExpirationDate + : new Date() : '' }, }, dateMaxEnforced() { - if (!this.isRemote) { - return this.config.isDefaultInternalExpireDateEnforced - && moment().add(1 + this.config.defaultInternalExpireDate, 'days') - } else { - return this.config.isDefaultRemoteExpireDateEnforced - && moment().add(1 + this.config.defaultRemoteExpireDate, 'days') + if (!this.isRemote && this.config.isDefaultInternalExpireDateEnforced) { + return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultInternalExpireDate)) + } else if (this.config.isDefaultRemoteExpireDateEnforced) { + return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultRemoteExpireDate)) } + return null }, /** diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue index 3802b79db9ea1..e1118e680c07f 100644 --- a/apps/files_sharing/src/components/SharingEntryLink.vue +++ b/apps/files_sharing/src/components/SharingEntryLink.vue @@ -98,20 +98,13 @@