diff options
author | 7PH <benjamin.raymond@sonarsource.com> | 2023-07-04 12:27:31 -0300 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-07-05 20:03:03 +0000 |
commit | 12e9d842aa71f646a60ce1ed948b2c29f0eb860a (patch) | |
tree | a63eb3d075bd8aa7b1cca01178635df9060f817c /server/sonar-web | |
parent | 7f9a6bff6af73bf3b82f90e19255b4aa6552cceb (diff) | |
download | sonarqube-12e9d842aa71f646a60ce1ed948b2c29f0eb860a.tar.gz sonarqube-12e9d842aa71f646a60ce1ed948b2c29f0eb860a.zip |
SONAR-19620 Fix invalid license date expiration due to date format
Diffstat (limited to 'server/sonar-web')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/query.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/helpers/query.ts b/server/sonar-web/src/main/js/helpers/query.ts index f332c3117a7..615534add4e 100644 --- a/server/sonar-web/src/main/js/helpers/query.ts +++ b/server/sonar-web/src/main/js/helpers/query.ts @@ -57,9 +57,13 @@ export function parseAsOptionalBoolean(value: string | undefined): boolean | und export function parseAsDate(value?: string): Date | undefined { if (value) { - // We atttemp to parse date that does not have time. - // Otherwise date will create a date at midnight UTC - // and it does not play well when we get the local day. + /** + * When the time zone offset is absent, date-only forms are interpreted as a UTC time + * and date-time forms are interpreted as local time. + * To ensure we always parse dates as date-time, we first try and add the time to the date, + * and if it fails, we try and parse the date as is. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date + */ let date = parseDate(value + ' 00:00:00'); if (isValidDate(date)) { return date; |