George Powell 77ffd6fbee Implement client-side timezone handling for daily verses
Refactored the daily verse system to properly handle users across different
timezones. Previously, the server used a fixed timezone (America/New_York),
causing users in other timezones to see incorrect verses near midnight.

Key changes:

**Server-side refactoring:**
- Extract `getVerseForDate()` into `src/lib/server/daily-verse.ts` for reuse
- Page load now uses UTC date for initial SSR (fast initial render)
- New `/api/daily-verse` POST endpoint accepts client-calculated date
- Server no longer calculates dates; uses client-provided date directly

**Client-side timezone handling:**
- Client calculates local date using browser's timezone on mount
- If server date doesn't match local date, fetches correct verse via API
- Changed verse data from `$derived` to `$state` to fix reactivity issues
- Mutating props was causing updates to fail; now uses local state
- Added effect to reload page when user returns to stale tab on new day

**Stats page improvements:**
- Accept `tz` query parameter for accurate streak calculations
- Use client's local date when determining "today" for current streaks
- Prevents timezone-based streak miscalculations

**Developer experience:**
- Added debug panel showing client local time vs daily verse date
- Added console logging for timezone fetch process
- Comprehensive test suite for timezone handling and streak logic

**UI improvements:**
- Share text uses 📜 emoji for logged-in users, 📖 for anonymous
- Stats link now includes timezone parameter for accurate display

This ensures users worldwide see the correct daily verse for their local
date, and streaks are calculated based on their timezone, not server time.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-12 23:37:08 -05:00
2026-02-02 02:52:53 -05:00
2025-12-19 03:36:59 -05:00
2026-02-05 00:47:55 -05:00
2025-12-26 01:11:45 -05:00
2026-02-12 20:24:38 -05:00
2026-02-09 12:03:31 -05:00
2026-02-02 02:07:12 -05:00
2025-12-16 10:23:24 -05:00
2026-02-02 00:48:35 -05:00
2025-12-22 23:57:46 -05:00
2025-12-16 18:46:53 -05:00
2026-02-05 18:13:47 -05:00
2026-02-05 18:13:30 -05:00
2026-01-26 23:45:52 -05:00
2025-12-16 10:23:24 -05:00
2026-02-02 02:52:53 -05:00
2026-02-05 18:13:30 -05:00
2025-12-16 10:23:24 -05:00
2025-12-16 10:23:24 -05:00

sv

Everything you need to build a Svelte project, powered by sv.

Creating a project

If you're seeing this, you've probably already done this step. Congrats!

# create a new project in the current directory
bunx sv create

# create a new project in my-app
bunx sv create my-app

Developing

Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:

bun run dev

# or start the server and open the app in a new browser tab
bun run dev -- --open

Building

To create a production version of your app:

bun run build

You can preview the production build with bun run preview.

To deploy your app, you may need to install an adapter for your target environment.

Description
No description provided
Readme 4.6 MiB
Languages
TypeScript 56.3%
Svelte 41.7%
Shell 1.4%
CSS 0.4%
JavaScript 0.1%
Other 0.1%