Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
type="date"
:min="dateTomorrow"
:max="maxExpirationDateEnforced"
@change="expirationDateChanged($event)">
@update:model-value="onExpirationChange"
@change="expirationDateChanged">
<template #icon>
<IconCalendarBlank :size="20" />
</template>
Expand Down Expand Up @@ -874,9 +875,9 @@ export default {
},

expirationDateChanged(event) {
const date = event.target.value
this.onExpirationChange(date)
this.defaultExpirationDateEnabled = !!date
const value = event?.target?.value
const isValid = !!value && !isNaN(new Date(value).getTime())
this.defaultExpirationDateEnabled = isValid
},

/**
Expand Down
9 changes: 7 additions & 2 deletions apps/files_sharing/src/mixins/SharesMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,13 @@ export default {
* @param {Date} date
*/
onExpirationChange(date) {
const formattedDate = date ? this.formatDateToString(new Date(date)) : ''
this.share.expireDate = formattedDate
if (!date) {
this.share.expireDate = null
this.$set(this.share, 'expireDate', null)
return
}
const parsedDate = (date instanceof Date) ? date : new Date(date)
this.share.expireDate = this.formatDateToString(parsedDate)
},

/**
Expand Down