AWS Cloudscape LineChart UTC Date Time issue

28 Views Asked by At

I use AWS Cloudscape's LineChart. I noticed that when I provide the data as:

[
  {x: 1711438500001, y: 0},
  {x: 1711438500001, y: 0},
  {x: 1711438800001, y: 0},
  {x: 1711439100001, y: 3},
  {x: 1711439400001, y: 6}
]

It does not show the date and time in UTC, instead it shows them both on x axis and line as local time. This is how I have used LineChart:

<LineChart
series={[{
    title: 'Passengers Count',
    type: 'line',
    data: reports
}]}
xDomain={[
    new Date(startDateTime),
    new Date(endDateTime)
]}
yDomain={[0, maxPassengersCount + maxPassengersCount / 10]}
i18nStrings={{
    xTickFormatter: e =>
        new Date(e).toLocaleDateString('en-US', {
            month: 'short',
            day: 'numeric',
            hour: 'numeric',
            minute: 'numeric',
            hour12: !1
        })
            .split(',')
            .join('\n')
}}
ariaLabel='Passengers Count'
height={700}
hideFilter
hideLegend
xScaleType='time'
xTitle='Date Time (UTC)'
yTitle='Passengers Count'
empty={<Box textAlign='center' color='inherit'><b>No data available</b></Box>}
noMatch={<Box textAlign='center' color='inherit'><b>No matching data</b></Box>}/>

I would appreciate any hint that helps me fix this.

startDateTime: "2024-03-26T00:00:00+00:00"
endDateTime: "2024-04-01T23:59:59+00:00"
0

There are 0 best solutions below