Fix empty value for expiry date (#64893)

This commit is contained in:
linoman 2023-03-20 13:32:20 +01:00 committed by GitHub
parent 7860ca6c3d
commit b3243486e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,8 +38,10 @@ export const CreateTokenModal = ({ isOpen, token, serviceAccountLogin, onCreateT
tomorrow.setDate(tomorrow.getDate() + 1);
const maxExpirationDate = new Date();
if (config.tokenExpirationDayLimit !== undefined) {
if (config.tokenExpirationDayLimit !== undefined && config.tokenExpirationDayLimit > -1) {
maxExpirationDate.setDate(maxExpirationDate.getDate() + config.tokenExpirationDayLimit + 1);
} else {
maxExpirationDate.setDate(8640000000000000);
}
const defaultExpirationDate = config.tokenExpirationDayLimit !== undefined && config.tokenExpirationDayLimit > 0;