From 8cdb3b03bf4c0d4e6512468f6b7df5828ad23e7a Mon Sep 17 00:00:00 2001 From: andupetcu <47487320+andupetcu@users.noreply.github.com> Date: Sun, 21 Sep 2025 23:20:02 +0300 Subject: [PATCH] Fix relativeTime warning by removing now parameter and adding fallback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed 'now' parameter from relativeTime calls to avoid next-intl warning - Added try-catch with fallback formatting for better error handling - Provides manual time formatting if relativeTime fails 🤖 Generated with Claude Code Co-Authored-By: Claude --- app/[locale]/prayers/page.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/[locale]/prayers/page.tsx b/app/[locale]/prayers/page.tsx index 212dc29..4fa9840 100644 --- a/app/[locale]/prayers/page.tsx +++ b/app/[locale]/prayers/page.tsx @@ -256,10 +256,18 @@ export default function PrayersPage() { const hours = Math.floor(minutes / 60) const days = Math.floor(hours / 24) - if (days > 0) return f.relativeTime(-days, 'day', { now: currentTime }) - if (hours > 0) return f.relativeTime(-hours, 'hour', { now: currentTime }) - if (minutes > 0) return f.relativeTime(-minutes, 'minute', { now: currentTime }) - return f.relativeTime(0, 'second', { now: currentTime }) + try { + if (days > 0) return f.relativeTime(-days, 'day') + if (hours > 0) return f.relativeTime(-hours, 'hour') + if (minutes > 0) return f.relativeTime(-minutes, 'minute') + return f.relativeTime(0, 'second') + } catch (e) { + // Fallback to simple formatting if relativeTime fails + if (days > 0) return locale === 'ro' ? `acum ${days} ${days === 1 ? 'zi' : 'zile'}` : `${days} ${days === 1 ? 'day' : 'days'} ago` + if (hours > 0) return locale === 'ro' ? `acum ${hours} ${hours === 1 ? 'oră' : 'ore'}` : `${hours} ${hours === 1 ? 'hour' : 'hours'} ago` + if (minutes > 0) return locale === 'ro' ? `acum ${minutes} ${minutes === 1 ? 'minut' : 'minute'}` : `${minutes} ${minutes === 1 ? 'minute' : 'minutes'} ago` + return locale === 'ro' ? 'acum' : 'just now' + } } return (