Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Kim <gary@garykim.dev>2020-05-01 12:06:24 +0300
committerGary Kim <gary@garykim.dev>2020-05-02 13:58:41 +0300
commit8dd23f98542417829162f829c0ed63f11e1d8e3e (patch)
tree7832f2b1dd52f91661a5ef4f6329945cc0009cb9 /apps/files_sharing/src/mixins/SharesMixin.js
parente77e0b0e2f034633307fcc054d582c0567090776 (diff)
Fix expiry datepicker allowing all dates
vue2-datepicker expects a `disabled-date` function rather than `not-before` and `not-after` dates. This commit updates it so that we now provide vue2-datepicker with a `disabled-date` function. Signed-off-by: Gary Kim <gary@garykim.dev>
Diffstat (limited to 'apps/files_sharing/src/mixins/SharesMixin.js')
-rw-r--r--apps/files_sharing/src/mixins/SharesMixin.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js
index 8806209954a..e19af48bc7e 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'))
+ },
},
}