diff --git a/src/components/info/info.js b/src/components/info/info.js index 05bc818c2..1e1304a31 100644 --- a/src/components/info/info.js +++ b/src/components/info/info.js @@ -70,7 +70,7 @@ export const createSummary = (mainTreeNumTips, nodes, filters, visibility, visib let summary = ""; /* text returned from this function */ /* Number of genomes & their date range */ - if (branchLengthsToDisplay !== "divOnly") { + if (branchLengthsToDisplay !== "divOnly" && nSelectedSamples > 0) { summary += t( "Showing {{x}} of {{y}} genomes sampled between {{from}} and {{to}}.", { diff --git a/src/util/treeVisibilityHelpers.js b/src/util/treeVisibilityHelpers.js index ac8fecfa6..96f024868 100644 --- a/src/util/treeVisibilityHelpers.js +++ b/src/util/treeVisibilityHelpers.js @@ -7,9 +7,7 @@ export const getVisibleDateRange = (nodes, visibility) => nodes .filter((node, idx) => (visibility[idx] === NODE_VISIBLE && !node.hasChildren)) .reduce((acc, node) => { const nodeDate = getTraitFromNode(node, "num_date"); - if (nodeDate && nodeDate < acc[0]) return [nodeDate, acc[1]]; - if (nodeDate && nodeDate > acc[1]) return [acc[0], nodeDate]; - return acc; + return nodeDate ? [Math.min(nodeDate, acc[0]), Math.max(nodeDate, acc[1])] : acc; }, [100000, -100000]); export const strainNameToIdx = (nodes, name) => {