You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by kg...@apache.org on 2024/07/23 14:23:48 UTC

(superset) branch master updated: fix: Use default custom time range time without timezone (#29669)

This is an automated email from the ASF dual-hosted git repository.

kgabryje pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new cd713a239e fix: Use default custom time range time without timezone (#29669)
cd713a239e is described below

commit cd713a239e8f8d0e990dda900632972586af8d00
Author: Kamil Gabryjelski <ka...@gmail.com>
AuthorDate: Tue Jul 23 16:23:40 2024 +0200

    fix: Use default custom time range time without timezone (#29669)
---
 .../src/time-comparison/customTimeRangeDecode.ts         |  8 ++++----
 .../test/time-comparison/customTimeRangeDecode.test.ts   | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-core/src/time-comparison/customTimeRangeDecode.ts b/superset-frontend/packages/superset-ui-core/src/time-comparison/customTimeRangeDecode.ts
index d99c78281c..bb5c3d4856 100644
--- a/superset-frontend/packages/superset-ui-core/src/time-comparison/customTimeRangeDecode.ts
+++ b/superset-frontend/packages/superset-ui-core/src/time-comparison/customTimeRangeDecode.ts
@@ -39,14 +39,14 @@ export const ISO8601_AND_CONSTANT = RegExp(
 );
 const DATETIME_CONSTANT = ['now', 'today'];
 const SEVEN_DAYS_AGO = new Date();
-SEVEN_DAYS_AGO.setUTCHours(0, 0, 0, 0);
+SEVEN_DAYS_AGO.setHours(0, 0, 0, 0);
 
 const MIDNIGHT = new Date();
-MIDNIGHT.setUTCHours(0, 0, 0, 0);
+MIDNIGHT.setHours(0, 0, 0, 0);
 
 const defaultCustomRange: CustomRangeType = {
-  sinceDatetime: SEVEN_DAYS_AGO.setUTCDate(
-    SEVEN_DAYS_AGO.getUTCDate() - 7,
+  sinceDatetime: SEVEN_DAYS_AGO.setDate(
+    SEVEN_DAYS_AGO.getDate() - 7,
   ).toString(),
   sinceMode: 'relative',
   sinceGrain: 'day',
diff --git a/superset-frontend/packages/superset-ui-core/test/time-comparison/customTimeRangeDecode.test.ts b/superset-frontend/packages/superset-ui-core/test/time-comparison/customTimeRangeDecode.test.ts
index b3e86166e8..d5342098a5 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-comparison/customTimeRangeDecode.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-comparison/customTimeRangeDecode.test.ts
@@ -151,14 +151,14 @@ describe('customTimeRangeDecode', () => {
   it('7) default', () => {
     const SEVEN_DAYS_AGO = new Date();
     const MIDNIGHT = new Date();
-    SEVEN_DAYS_AGO.setUTCHours(0, 0, 0, 0);
-    MIDNIGHT.setUTCHours(0, 0, 0, 0);
+    SEVEN_DAYS_AGO.setHours(0, 0, 0, 0);
+    MIDNIGHT.setHours(0, 0, 0, 0);
     expect(
       customTimeRangeDecode('now : DATEADD(DATETIME("TODAY"), -7, day)'),
     ).toEqual({
       customRange: {
-        sinceDatetime: SEVEN_DAYS_AGO.setUTCDate(
-          SEVEN_DAYS_AGO.getUTCDate() - 7,
+        sinceDatetime: SEVEN_DAYS_AGO.setDate(
+          SEVEN_DAYS_AGO.getDate() - 7,
         ).toString(),
         sinceMode: 'relative',
         sinceGrain: 'day',
@@ -176,18 +176,18 @@ describe('customTimeRangeDecode', () => {
 
   it('8) relative : relative return default', () => {
     const SEVEN_DAYS_AGO = new Date();
-    SEVEN_DAYS_AGO.setUTCHours(0, 0, 0, 0);
+    SEVEN_DAYS_AGO.setHours(0, 0, 0, 0);
 
     const MIDNIGHT = new Date();
-    MIDNIGHT.setUTCHours(0, 0, 0, 0);
+    MIDNIGHT.setHours(0, 0, 0, 0);
     expect(
       customTimeRangeDecode(
         'DATEADD(DATETIME("2021-01-26T00:00:00"), -55, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
       ),
     ).toEqual({
       customRange: {
-        sinceDatetime: SEVEN_DAYS_AGO.setUTCDate(
-          SEVEN_DAYS_AGO.getUTCDate() - 7,
+        sinceDatetime: SEVEN_DAYS_AGO.setDate(
+          SEVEN_DAYS_AGO.getDate() - 7,
         ).toString(),
         sinceMode: 'relative',
         sinceGrain: 'day',