cal-heatmap icon indicating copy to clipboard operation
cal-heatmap copied to clipboard

Hours subdomain is not honoring local browser time

Open empireshades opened this issue 1 year ago • 2 comments

I've commented on other issues but I wanted to log this here officially as well. When I use domain: day with subdomain: hour, the timezone appears in UTC and does not honor my local browser time. I've tried this with multiple Date formats in different input timezones including string and also epoch. The only thing that seems to make a minor difference is if I set the timezone to 'America/Los_Angeles' but even then the time only gets shifted by an hour for the epoch entry only. Thank you.

Full example: JS Fiddle

JS:

const cal = new CalHeatmap();
cal.paint({
  range: 5,
  domain: {
    type: 'day'
  },
  subDomain: {
    type: 'hour'
  },
  date: {
    start: new Date('2023-03-09'),
    //timezone: 'America/Los_Angeles'
  },
  data: {
    defaultValue: 0,

    source: [{
        date: new Date('Mar 10 2023 07:00:00 GMT-0700'),
        rate: 3
      },
      {
        date: new Date('Sat Mar 11 2023 08:00:00 GMT+0800 (Chinese Standard Time)'),
        rate: 1
      },
      {
        date: 1678606470000, //GMT: Sunday, March 12, 2023 7:34:30 AM
        rate: 4
      },
    ],
    x: 'date',
    y: 'rate'
  },
  scale: {
    opacity: {
      baseColor: 'red',
      domain: [0, 5],
    }
  }
}, [
  [Tooltip]
]);

empireshades avatar Jan 31 '24 02:01 empireshades

Same problem here

Tang59 avatar Feb 05 '24 15:02 Tang59

Same problem here

forrany avatar Jul 17 '24 07:07 forrany