diff --git a/src/pages/DailyChallenge.tsx b/src/pages/DailyChallenge.tsx index 77fae22..3d0cca5 100644 --- a/src/pages/DailyChallenge.tsx +++ b/src/pages/DailyChallenge.tsx @@ -8,7 +8,7 @@ import PageLayout from '@/components/layout/PageLayout'; import { getTodaysChallenge, type DailyChallenge as DailyChallengeType } from '@/api/daily-challenges'; import { checkDailyCompletion } from '@/api/leaderboards'; import { useAuthStore } from '@/stores/auth-store'; -import { Loader2, Calendar, Trophy } from 'lucide-react'; +import { Loader2, Calendar, Trophy, Clock } from 'lucide-react'; export default function DailyChallenge() { const [challenge, setChallenge] = useState(null); @@ -67,6 +67,19 @@ export default function DailyChallenge() { }); }; + const getLocalResetTime = () => { + // Next midnight UTC, displayed in the user's local timezone + const now = new Date(); + const nextMidnightUtc = new Date( + Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + 1), + ); + return nextMidnightUtc.toLocaleTimeString([], { + hour: 'numeric', + minute: '2-digit', + timeZoneName: 'short', + }); + }; + return (
@@ -139,6 +152,11 @@ export default function DailyChallenge() { )}
+ +
+ + New challenge at midnight UTC ({getLocalResetTime()} local) +
)}