Add support for MySQL.

This commit is contained in:
Mike Cao 2020-08-11 20:05:40 -07:00
parent e309376150
commit a248f35db2
9 changed files with 302 additions and 102 deletions

View file

@ -97,7 +97,9 @@ export function getDateArray(data, startDate, endDate, unit) {
const n = diff(endDate, startDate) + 1;
function findData(t) {
const x = data.find(e => new Date(e.t).getTime() === normalize(new Date(t)).getTime());
const x = data.find(e => {
return getLocalTime(new Date(e.t)).getTime() === normalize(new Date(t)).getTime();
});
return x?.y || 0;
}
@ -109,5 +111,7 @@ export function getDateArray(data, startDate, endDate, unit) {
arr.push({ t, y });
}
console.log({ unit, arr });
return arr;
}