diff options
author | julia.kirschenheuter <julia.kirschenheuter@nextcloud.com> | 2022-09-06 12:43:50 +0200 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2022-10-06 08:56:06 +0000 |
commit | 1eac730cafa99bf47924e0d70c43e0e2cf6d0455 (patch) | |
tree | 2596a7241e984a0ef4586bffac15bcb11e0e36bf /apps/files_sharing/src/services | |
parent | b57115df3ff0c7ffc23ed5844225df2d21e4ee5b (diff) | |
download | nextcloud-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/services')
-rw-r--r-- | apps/files_sharing/src/services/ConfigService.js | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/apps/files_sharing/src/services/ConfigService.js b/apps/files_sharing/src/services/ConfigService.js index bfef48a8ade..e3cd6ad8d46 100644 --- a/apps/files_sharing/src/services/ConfigService.js +++ b/apps/files_sharing/src/services/ConfigService.js @@ -60,57 +60,45 @@ export default class Config { } /** - * Get the default link share expiration date as string + * Get the default link share expiration date * - * @return {string} + * @return {Date|null} * @readonly * @memberof Config */ - get defaultExpirationDateString() { - let expireDateString = '' + get defaultExpirationDate() { if (this.isDefaultExpireDateEnabled) { - const date = window.moment.utc() - const expireAfterDays = this.defaultExpireDate - date.add(expireAfterDays, 'days') - expireDateString = date.format('YYYY-MM-DD') + return new Date(new Date().setDate(new Date().getDate() + this.defaultExpireDate)) } - return expireDateString + return null } /** - * Get the default internal expiration date as string + * Get the default internal expiration date * - * @return {string} + * @return {Date|null} * @readonly * @memberof Config */ - get defaultInternalExpirationDateString() { - let expireDateString = '' + get defaultInternalExpirationDate() { if (this.isDefaultInternalExpireDateEnabled) { - const date = window.moment.utc() - const expireAfterDays = this.defaultInternalExpireDate - date.add(expireAfterDays, 'days') - expireDateString = date.format('YYYY-MM-DD') + return new Date(new Date().setDate(new Date().getDate() + this.defaultInternalExpireDate)) } - return expireDateString + return null } /** - * Get the default remote expiration date as string + * Get the default remote expiration date * - * @return {string} + * @return {Date|null} * @readonly * @memberof Config */ get defaultRemoteExpirationDateString() { - let expireDateString = '' if (this.isDefaultRemoteExpireDateEnabled) { - const date = window.moment.utc() - const expireAfterDays = this.defaultRemoteExpireDate - date.add(expireAfterDays, 'days') - expireDateString = date.format('YYYY-MM-DD') + return new Date(new Date().setDate(new Date().getDate() + this.defaultRemoteExpireDate)) } - return expireDateString + return null } /** @@ -191,6 +179,17 @@ export default class Config { } /** + * Is there a default expiration date for new remote shares ? + * + * @return {boolean} + * @readonly + * @memberof Config + */ + get isDefaultRemoteExpireDateEnabled() { + return OC.appConfig.core.defaultRemoteExpireDateEnabled === true + } + + /** * Are users on this server allowed to send shares to other servers ? * * @return {boolean} |