Commit 9307ea97 authored by hcordeiro's avatar hcordeiro
Browse files

add date validation check before casting to string

No related merge requests found
Pipeline #14083 passed with stages
in 9 minutes and 32 seconds
Showing with 2 additions and 2 deletions
+2 -2
......@@ -48,7 +48,7 @@ function showErrorShorelineImages(){
clearInterval(intervalCodeShowErrorShorelineImages);
}
}
function sortOutput(data){
function sortOutput(data){ // TODO make nan safe, test corner cases, improve sorting, separate date and distance treatment in functions
data.forEach(el=>{
let txtDates = el.dates;
let txtDistances = el.distances;
......@@ -83,7 +83,7 @@ function sortOutput(data){
}
}
} while (swapped);
dates = dates.map(el => el.toISOString());
dates = dates.map(el => isFinite(el) ? el.toISOString() : "");
distancesTxtArray = distancesTxtArray.map(el => Number.parseFloat(el).toFixed(2));
el.dates = '"' + JSON.stringify(dates).replace(/"/g, "'").replace(/.000Z/g,"") +'"';
el.distances = '"' + JSON.stringify(distancesTxtArray).replace(/"/g, "'").replace(/'/g, "") +'"' ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment