summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/mixins/SharesMixin.js
diff options
context:
space:
mode:
authorjulia.kirschenheuter <julia.kirschenheuter@nextcloud.com>2022-09-06 12:43:50 +0200
committernextcloud-command <nextcloud-command@users.noreply.github.com>2022-10-06 08:56:06 +0000
commit1eac730cafa99bf47924e0d70c43e0e2cf6d0455 (patch)
tree2596a7241e984a0ef4586bffac15bcb11e0e36bf /apps/files_sharing/src/mixins/SharesMixin.js
parentb57115df3ff0c7ffc23ed5844225df2d21e4ee5b (diff)
downloadnextcloud-server-1eac730cafa99bf47924e0d70c43e0e2cf6d0455.tar.gz
nextcloud-server-1eac730cafa99bf47924e0d70c43e0e2cf6d0455.zip
Replace moment.js date with Date Object.
Replace vue2-datepicker with native date picker for expiration date. Signed-off-by: julia.kirschenheuter <julia.kirschenheuter@nextcloud.com> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/files_sharing/src/mixins/SharesMixin.js')
-rw-r--r--apps/files_sharing/src/mixins/SharesMixin.js26
1 files changed, 5 insertions, 21 deletions
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'))
- },
},
}