diff --git a/src/components/tree/infoPanels/hover.js b/src/components/tree/infoPanels/hover.js index 8618e07f6..78a66e88f 100644 --- a/src/components/tree/infoPanels/hover.js +++ b/src/components/tree/infoPanels/hover.js @@ -33,22 +33,24 @@ const getBranchDivJSX = (d) =>
{infoLineJSX("Divergence:", prettyString(d.attr.div.toExponential(3)))}
; const getBranchTimeJSX = (d, temporalConfidence) => { - const dates = [numericToCalendar(d.attr.num_date)]; + const date = d.attr.date || numericToCalendar(d.attr.num_date); + let dateRange = false; if (temporalConfidence) { - dates[1] = numericToCalendar(d.attr.num_date_confidence[0]); - dates[2] = numericToCalendar(d.attr.num_date_confidence[1]); - if (dates[1] === dates[2]) { - return{infoLineJSX("Date:", dates[0])}
; - } + dateRange = [ + numericToCalendar(d.attr.num_date_confidence[0]), + numericToCalendar(d.attr.num_date_confidence[1]) + ]; + } + if (dateRange && dateRange[0] !== dateRange[1]) { return (
- {infoLineJSX("Inferred Date:", dates[0])}
+ {infoLineJSX("Inferred Date:", date)}
- {infoLineJSX("Date Confidence Interval:", `(${dates[1]}, ${dates[2]})`)}
+ {infoLineJSX("Date Confidence Interval:", `(${dateRange[0]}, ${dateRange[1]})`)}
{infoLineJSX("Date:", dates[0])}
; + return ({infoLineJSX("Date:", date)}
); }; /**