summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2026-03-02 20:28:43 +0000
committerGreg Roach <greg@subaqua.co.uk>2026-03-02 20:28:43 +0000
commit27719772b50adb162ee51f773ba93aa6b9381d5d (patch)
treefdb666e27ce38d652021aa93508ff052c904f755
parent0e3ca49308ce1176dd649d76226613f8fda9d1a6 (diff)
downloadwebtrees-27719772b50adb162ee51f773ba93aa6b9381d5d.tar.gz
webtrees-27719772b50adb162ee51f773ba93aa6b9381d5d.tar.bz2
webtrees-27719772b50adb162ee51f773ba93aa6b9381d5d.zip
Fix: #5327 - Lifespan chart errors when no dates available
-rw-r--r--app/Module/LifespansChartModule.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/Module/LifespansChartModule.php b/app/Module/LifespansChartModule.php
index 64d7ee3ebc..6028640680 100644
--- a/app/Module/LifespansChartModule.php
+++ b/app/Module/LifespansChartModule.php
@@ -285,6 +285,11 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac
return $carry;
}, 0);
+ // No dates? Show the current year.
+ if ($jd === 0) {
+ return (int) date('Y');
+ }
+
$year = $this->jdToYear($jd);
// Don't show future dates
@@ -308,6 +313,11 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac
return $carry;
}, PHP_INT_MAX);
+ // No dates? Show the current year.
+ if ($jd === PHP_INT_MAX) {
+ return (int) date('Y');
+ }
+
return $this->jdToYear($jd);
}