Fixed issue with incorrect chart time

This commit is contained in:
sairaj mote 2022-05-10 13:05:53 +05:30
parent a6425cb2d2
commit d572d1bca9

View File

@ -865,15 +865,14 @@
//Checks for internet connection status //Checks for internet connection status
if (!navigator.onLine) if (!navigator.onLine)
notify( notify(
"There seems to be a problem connecting to the internet, Please check you internet connection.", "There seems to be a problem connecting to the internet. Please check your internet connection.",
"error", "error",
{ sound: true }
); );
window.addEventListener("offline", () => { window.addEventListener("offline", () => {
notify( notify(
"There seems to be a problem connecting to the internet, Please check you internet connection.", "There seems to be a problem connecting to the internet. Please check your internet connection.",
"error", "error",
{ pinned: true, sound: true } { pinned: true }
); );
}); });
window.addEventListener("online", () => { window.addEventListener("online", () => {
@ -1446,6 +1445,11 @@
intervals: {}, intervals: {},
timeouts: {} timeouts: {}
} }
// convert GMT to IST
function getIST(originalTime) {
const d = new Date(originalTime);
return Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()) / 1000;
}
const render = { const render = {
listedAsset(asset, rate, countDown) { listedAsset(asset, rate, countDown) {
const clone = getRef('listed_asset_template').content.cloneNode(true).firstElementChild const clone = getRef('listed_asset_template').content.cloneNode(true).firstElementChild
@ -1532,8 +1536,9 @@
chart(asset, duration = '48 weeks') { chart(asset, duration = '48 weeks') {
floExchangeAPI.getRateHistory(asset, duration).then(data => { floExchangeAPI.getRateHistory(asset, duration).then(data => {
data = data.map(({ time, rate }) => { data = data.map(({ time, rate }) => {
console.log(time, getIST(time))
return { return {
time: new Date(time).getTime() / 1000, time: getIST(time),
value: rate value: rate
} }
}) })