diff --git a/src/app/components/dialog/CoastlineEvolutionDialog.jsx b/src/app/components/dialog/CoastlineEvolutionDialog.jsx index 03a286f667b9ecda126b00313628339d3f555728..a47dd7942ae7c9b46ac485cde2967813fc250c89 100644 --- a/src/app/components/dialog/CoastlineEvolutionDialog.jsx +++ b/src/app/components/dialog/CoastlineEvolutionDialog.jsx @@ -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, "") +'"' ;