Fix daily puzzle rotation timezone issue
- Added lib/dateUtils.ts for consistent timezone handling - Updated app/page.tsx and app/api/daily/route.ts to use Europe/Berlin timezone - Updated lib/gameState.ts to sync client-side daily check with server time - Exposed TZ env var to client in next.config.ts
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Game from '@/components/Game';
|
||||
import { getTodayISOString } from '@/lib/dateUtils';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
@@ -14,7 +15,7 @@ if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
|
||||
|
||||
async function getDailyPuzzle() {
|
||||
try {
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const today = getTodayISOString();
|
||||
console.log(`[getDailyPuzzle] Checking puzzle for date: ${today}`);
|
||||
|
||||
let dailyPuzzle = await prisma.dailyPuzzle.findUnique({
|
||||
|
||||
Reference in New Issue
Block a user