Skip to content

Commit 43c5232

Browse files
authored
Merge pull request #52364 from nextcloud/fix/51875/allow-keyboard-input-4-share-expiration-on-chrome
fix(files_sharing): Improve expiration date input change handling
2 parents 0567332 + 7a1c947 commit 43c5232

File tree

11 files changed

+19
-13
lines changed

11 files changed

+19
-13
lines changed

apps/files_sharing/src/components/SharingEntryLink.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@
108108
type="date"
109109
:min="dateTomorrow"
110110
:max="maxExpirationDateEnforced"
111-
@change="expirationDateChanged($event)">
111+
@update:model-value="onExpirationChange"
112+
@change="expirationDateChanged">
112113
<template #icon>
113114
<IconCalendarBlank :size="20" />
114115
</template>
@@ -874,9 +875,9 @@ export default {
874875
},
875876
876877
expirationDateChanged(event) {
877-
const date = event.target.value
878-
this.onExpirationChange(date)
879-
this.defaultExpirationDateEnabled = !!date
878+
const value = event?.target?.value
879+
const isValid = !!value && !isNaN(new Date(value).getTime())
880+
this.defaultExpirationDateEnabled = isValid
880881
},
881882
882883
/**

apps/files_sharing/src/mixins/SharesMixin.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,13 @@ export default {
234234
* @param {Date} date
235235
*/
236236
onExpirationChange(date) {
237-
const formattedDate = date ? this.formatDateToString(new Date(date)) : ''
238-
this.share.expireDate = formattedDate
237+
if (!date) {
238+
this.share.expireDate = null
239+
this.$set(this.share, 'expireDate', null)
240+
return
241+
}
242+
const parsedDate = (date instanceof Date) ? date : new Date(date)
243+
this.share.expireDate = this.formatDateToString(parsedDate)
239244
},
240245

241246
/**

dist/1162-1162.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/1162-1162.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/1162-1162.js.map.license

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1162-1162.js.license

dist/4409-4409.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/4409-4409.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/4409-4409.js.map.license

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/files_sharing-files_sharing_tab.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)