Skip to content
Snippets Groups Projects
Commit de2e5127 authored by Voytech-0's avatar Voytech-0
Browse files

limit max domain

parent f6e903dd
Branches master
No related tags found
No related merge requests found
......@@ -101,16 +101,28 @@ export default function MainPage() {
}
// Return the maximum datetime as an integer in milliseconds in the domain of a dataset
function getDomainMax(newHeatData) {
let domainMax = 0;
newHeatData.forEach(set => {
if(set.length > 0 && (new Date(set[set.length - 1].datetime).getTime() > domainMax)) {
domainMax = new Date(set[set.length - 1].datetime).getTime();
function getDomainMax(newHeatData) {
const targetDate = new Date("2021-10-01").getTime(); // Maximum allowed date: 1-10-21
let domainMax = 0;
newHeatData.forEach(set => {
if (set.length > 0) {
let index = set.length - 1;
while (index >= 0 && new Date(set[index].datetime).getTime() >= targetDate) {
index--;
}
});
if (domainMax === 0) return "auto";
return domainMax;
}
if (index >= 0) {
const currentDateTime = new Date(set[index].datetime).getTime();
if (currentDateTime > domainMax) {
domainMax = currentDateTime;
}
}
}
});
if (domainMax === 0) return "auto";
return domainMax;
}
// GET the metadata from the backend
async function getMetaData() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment