From 1eac730cafa99bf47924e0d70c43e0e2cf6d0455 Mon Sep 17 00:00:00 2001 From: "julia.kirschenheuter" Date: Tue, 6 Sep 2022 12:43:50 +0200 Subject: 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 --- apps/files_sharing/src/mixins/SharesMixin.js | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'apps/files_sharing/src/mixins/SharesMixin.js') diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js index 053babd3a1d..cdedd213aff 100644 --- a/apps/files_sharing/src/mixins/SharesMixin.js +++ b/apps/files_sharing/src/mixins/SharesMixin.js @@ -97,7 +97,7 @@ export default { }, dateTomorrow() { - return moment().add(1, 'days') + return new Date(new Date().setDate(new Date().getDate() + 1)) }, // Datepicker language @@ -142,7 +142,7 @@ export default { } } if (share.expirationDate) { - const date = moment(share.expirationDate) + const date = share.expirationDate if (!date.isValid()) { return false } @@ -151,16 +151,12 @@ export default { }, /** - * ActionInput can be a little tricky to work with. - * Since we expect a string and not a Date, - * we need to process the value here + * Save given value to expireDate and trigger queueUpdate * - * @param {Date} date js date to be parsed by moment.js + * @param {Date} date */ onExpirationChange(date) { - // format to YYYY-MM-DD - const value = moment(date).format('YYYY-MM-DD') - this.share.expireDate = value + this.share.expireDate = date this.queueUpdate('expireDate') }, @@ -318,17 +314,5 @@ export default { debounceQueueUpdate: debounce(function(property) { this.queueUpdate(property) }, 500), - - /** - * Returns which dates are disabled for the datepicker - * - * @param {Date} date date to check - * @return {boolean} - */ - disabledDate(date) { - const dateMoment = moment(date) - return (this.dateTomorrow && dateMoment.isBefore(this.dateTomorrow, 'day')) - || (this.dateMaxEnforced && dateMoment.isSameOrAfter(this.dateMaxEnforced, 'day')) - }, }, } -- cgit v1.2.3