fix: timeseries time zone issue for sql queries (#1555)

For SQL queries in some timezone, there was a difference between the
time showing in the x-axis. This issue is fixed by converting it to the
correct timezone.


![image](https://github.com/openobserve/openobserve/assets/124270523/babfa133-b012-492d-80af-dc6473f8c9a8)

Co-authored-by: ktx-keshavi <keshavi.bhalani@kiara.tech>
This commit is contained in:
ktx-kirtan
2023-09-21 17:33:52 +05:30
committed by GitHub
co-authored by ktx-keshavi
parent e7fcf1c6d9
commit 4509c4da2a
+2 -6
View File
@@ -74,10 +74,7 @@ export const convertSQLData = (
);
if (field && field.alias == key) {
// now we have the format, convert that format
result = result.map(
(it: any) =>
new Date(it).getTime() - new Date("1970-01-01T00:00:00").getTime()
);
result = result.map((it: any) => new Date(it+ "Z").getTime());
}
return result;
};
@@ -847,8 +844,7 @@ export const convertSQLData = (
if (isTimeSeries) {
options.series.map((seriesObj: any) => {
seriesObj.data = seriesObj.data.map((it: any, index: any) => [
new Date(options.xAxis.data[index]).getTime() -
new Date("1970-01-01T00:00:00").getTime(),
new Date(options.xAxis.data[index]+ "Z").getTime(),
it,
]);
});