Search code examples
javascriptvue.jsapexcharts

Apexcharts time not matching JavaScript/Python


In my Python

  2020-09-23T10:50:46.838023 

In JavaScript

  2020-09-23T10:50:46.838023

In JavaScript apexcharts format

  2020-09-23T03:50:46.838023

why has it changed the hour from 10 to 03?

This my Vue code

chartOptions: {
              chart: {
                id: "chart" + key,
                type: obj.chart,
                zoom: {
                  enabled: false,
                },
              },
              tooltip: {
                x: {
                  format: 'dd/MMM HH:mm:ss',
                }
              },
              xaxis: {
                type: "datetime",
                categories: obj.time,
                labels: {
                  show: true
                }
              },
            },
          };

My obj is object used for foreach loop.


Solution

  • If you want to display local time in ApexCharts, turn off the UTC flag on x-axis labels.

    xaxis: {
      labels: {
        datetimeUTC: false
      }
    }