diff options
author | Gary Kim <gary@garykim.dev> | 2020-05-01 12:06:24 +0300 |
---|---|---|
committer | Gary Kim <gary@garykim.dev> | 2020-05-02 13:58:41 +0300 |
commit | 8dd23f98542417829162f829c0ed63f11e1d8e3e (patch) | |
tree | 7832f2b1dd52f91661a5ef4f6329945cc0009cb9 /apps/files_sharing/src/mixins/SharesMixin.js | |
parent | e77e0b0e2f034633307fcc054d582c0567090776 (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.js | 11 |
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')) + }, }, } |