From 607f0b0e9a513cb317ae7c4d529285cc0cb48831 Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Thu, 18 Jul 2024 15:23:28 +0200 Subject: [PATCH] fix(files_sharing): file request expiration date timezone Signed-off-by: skjnldsv --- .../src/components/NewFileRequestDialog.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/src/components/NewFileRequestDialog.vue b/apps/files_sharing/src/components/NewFileRequestDialog.vue index 4ff31adb9ab..6b0bb5a1fc2 100644 --- a/apps/files_sharing/src/components/NewFileRequestDialog.vue +++ b/apps/files_sharing/src/components/NewFileRequestDialog.vue @@ -270,8 +270,19 @@ export default defineComponent({ async createShare() { this.loading = true + // This should never happen™ + if (this.expirationDate == null) { + throw new Error('Expiration date is missing') + } + + const year = this.expirationDate.getFullYear() + const month = (this.expirationDate.getMonth() + 1).toString().padStart(2, '0') + const day = this.expirationDate.getDate().toString().padStart(2, '0') + // Format must be YYYY-MM-DD - const expireDate = this.expirationDate ? this.expirationDate.toISOString().split('T')[0] : undefined + const expireDate = this.expirationDate + ? `${year}-${month}-${day}` + : undefined const shareUrl = generateOcsUrl('apps/files_sharing/api/v1/shares') try { const request = await axios.post(shareUrl, {