|
98 | 98 | </NcActionText> |
99 | 99 | <NcActionInput v-if="pendingExpirationDate" |
100 | 100 | v-model="share.expireDate" |
101 | | - v-tooltip.auto="{ |
102 | | - content: errors.expireDate, |
103 | | - show: errors.expireDate, |
104 | | - trigger: 'manual', |
105 | | - defaultContainer: '#app-sidebar' |
106 | | - }" |
107 | 101 | class="share-link-expire-date" |
108 | 102 | :disabled="saving" |
109 | | - |
110 | | - :lang="lang" |
111 | | - icon="" |
| 103 | + :is-native-picker="true" |
| 104 | + :hide-label="true" |
112 | 105 | type="date" |
113 | | - value-type="format" |
114 | | - :disabled-date="disabledDate"> |
| 106 | + :min="dateTomorrow" |
| 107 | + :max="dateMaxEnforced"> |
115 | 108 | <!-- let's not submit when picked, the user |
116 | 109 | might want to still edit or copy the password --> |
117 | 110 | {{ t('files_sharing', 'Enter a date') }} |
|
220 | 213 | </NcActionCheckbox> |
221 | 214 | <NcActionInput v-if="hasExpirationDate" |
222 | 215 | ref="expireDate" |
223 | | - v-tooltip.auto="{ |
224 | | - content: errors.expireDate, |
225 | | - show: errors.expireDate, |
226 | | - trigger: 'manual', |
227 | | - defaultContainer: '#app-sidebar' |
228 | | - }" |
| 216 | + :is-native-picker="true" |
| 217 | + :hide-label="true" |
229 | 218 | class="share-link-expire-date" |
230 | 219 | :class="{ error: errors.expireDate}" |
231 | 220 | :disabled="saving" |
232 | | - :lang="lang" |
233 | 221 | :value="share.expireDate" |
234 | | - value-type="format" |
235 | | - icon="icon-calendar-dark" |
236 | 222 | type="date" |
237 | | - :disabled-date="disabledDate" |
238 | | - @update:value="onExpirationChange"> |
| 223 | + :min="dateTomorrow" |
| 224 | + :max="dateMaxEnforced" |
| 225 | + @input="onExpirationChange"> |
239 | 226 | {{ t('files_sharing', 'Enter a date') }} |
240 | 227 | </NcActionInput> |
241 | 228 |
|
@@ -435,20 +422,22 @@ export default { |
435 | 422 | || !!this.share.expireDate |
436 | 423 | }, |
437 | 424 | set(enabled) { |
438 | | - let dateString = moment(this.config.defaultExpirationDateString) |
439 | | - if (!dateString.isValid()) { |
440 | | - dateString = moment() |
| 425 | + let defaultExpirationDate = this.config.defaultExpirationDate |
| 426 | + if (!defaultExpirationDate) { |
| 427 | + defaultExpirationDate = new Date() |
441 | 428 | } |
442 | 429 | this.share.state.expiration = enabled |
443 | | - ? dateString.format('YYYY-MM-DD') |
| 430 | + ? defaultExpirationDate |
444 | 431 | : '' |
445 | 432 | console.debug('Expiration date status', enabled, this.share.expireDate) |
446 | 433 | }, |
447 | 434 | }, |
448 | 435 |
|
449 | 436 | dateMaxEnforced() { |
450 | | - return this.config.isDefaultExpireDateEnforced |
451 | | - && moment().add(1 + this.config.defaultExpireDate, 'days') |
| 437 | + if (this.config.isDefaultExpireDateEnforced) { |
| 438 | + return new Date(new Date().setDate(new Date().getDate() + 1 + this.config.defaultExpireDate)) |
| 439 | + } |
| 440 | + return null |
452 | 441 | }, |
453 | 442 |
|
454 | 443 | /** |
@@ -631,7 +620,7 @@ export default { |
631 | 620 | if (this.config.isDefaultExpireDateEnforced) { |
632 | 621 | // default is empty string if not set |
633 | 622 | // expiration is the share object key, not expireDate |
634 | | - shareDefaults.expiration = this.config.defaultExpirationDateString |
| 623 | + shareDefaults.expiration = this.config.defaultExpirationDate |
635 | 624 | } |
636 | 625 | if (this.config.enableLinkPasswordByDefault) { |
637 | 626 | shareDefaults.password = await GeneratePassword() |
|
0 commit comments