From: Mathieu Suen Date: Wed, 2 Nov 2022 09:22:36 +0000 (-0400) Subject: SONAR-17539 Fix timezone issue when searching for issues or rules X-Git-Tag: 9.8.0.63668~157 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=476c3847569494bda057ca75214fead9367c1f79;p=sonarqube.git SONAR-17539 Fix timezone issue when searching for issues or rules --- diff --git a/server/sonar-web/src/main/js/helpers/query.ts b/server/sonar-web/src/main/js/helpers/query.ts index 85b9347fe9d..d2fdc30e226 100644 --- a/server/sonar-web/src/main/js/helpers/query.ts +++ b/server/sonar-web/src/main/js/helpers/query.ts @@ -57,7 +57,14 @@ export function parseAsOptionalBoolean(value: string | undefined): boolean | und export function parseAsDate(value?: string): Date | undefined { if (value) { - const date = parseDate(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. + let date = parseDate(value + ' 00:00:00'); + if (isValidDate(date)) { + return date; + } + date = parseDate(value); if (isValidDate(date)) { return date; }