You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2023/08/15 16:35:43 UTC
[superset] branch master updated: fix: Calendar Heatmap day offset (#24989)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina 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 025e4d4772 fix: Calendar Heatmap day offset (#24989)
025e4d4772 is described below
commit 025e4d4772e778097da7b9e1675782b73eaa887c
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Tue Aug 15 13:35:35 2023 -0300
fix: Calendar Heatmap day offset (#24989)
---
.../src/vendor/cal-heatmap.js | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js
index 760bf0ce2b..482a315392 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js
@@ -296,8 +296,21 @@ var CalHeatMap = function () {
// Used mainly to convert the datas if they're not formatted like expected
// Takes the fetched "data" object as argument, must return a json object
// formatted like {timestamp:count, timestamp2:count2},
- afterLoadData: function (data) {
- return data;
+ afterLoadData: function (timestamps) {
+ // See https://github.com/wa0x6e/cal-heatmap/issues/126#issuecomment-373301803
+ const stdTimezoneOffset = date => {
+ const jan = new Date(date.getFullYear(), 0, 1);
+ const jul = new Date(date.getFullYear(), 6, 1);
+ return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
+ };
+ const offset = stdTimezoneOffset(new Date()) * 60;
+ let results = {};
+ for (let timestamp in timestamps) {
+ const value = timestamps[timestamp];
+ timestamp = parseInt(timestamp, 10);
+ results[timestamp + offset] = value;
+ }
+ return results;
},
// Callback triggered after calling and completing update().