RORK LABJP
MAX — Rork Max generates native Swift apps across iPhone, iPad, Watch, TV, Vision Pro, and iMessageNATIVE — It reaches AR/LiDAR scanning, Metal 3D games, widgets, Live Activities, and on-device Core MLFUNDING — Rork raised $2.8M from a16z, with 743K monthly visits and 85% growthPRICING — It's free to start, with paid plans beginning at $25 per monthFLOW — Describe your idea in plain English to get working code, a shareable test link, and iOS/Android buildsCOMPARE — The original Rork builds cross-platform apps on Expo/React Native; choose the right tool per goalMAX — Rork Max generates native Swift apps across iPhone, iPad, Watch, TV, Vision Pro, and iMessageNATIVE — It reaches AR/LiDAR scanning, Metal 3D games, widgets, Live Activities, and on-device Core MLFUNDING — Rork raised $2.8M from a16z, with 743K monthly visits and 85% growthPRICING — It's free to start, with paid plans beginning at $25 per monthFLOW — Describe your idea in plain English to get working code, a shareable test link, and iOS/Android buildsCOMPARE — The original Rork builds cross-platform apps on Expo/React Native; choose the right tool per goal
Articles/App Dev
App Dev/2026-06-27Advanced

When a User Rewinds the Clock, Today's Card Shouldn't Break — Day Boundaries and Streak Integrity in a Daily-Content App

Daily 'card of the day' content breaks under timezone travel and manual clock changes, showing duplicates, gaps, or lost streaks. Here is a deterministic day-key and monotonic-clock design, in real Rork (Expo) code, that keeps it solid.

Rork461Expo114Date handlingStreaksRetention design2

Premium Article

Running a daily "card of the day" app as an indie developer, I started getting the same handful of reports after a while: "I see yesterday's image again today," and "my streak suddenly reset to zero." When I dug into the conditions, the users were either traveling abroad or had just nudged their device clock forward and back to chase a reward in some game.

Daily content looks trivial — show the next item when the date changes. But the moment you trust new Date() directly, three sources of drift pour into that one spot: timezone travel, daylight saving, and manual clock changes. This is a design that funnels all of that into one place and makes "today" deterministic, written as code that runs in a Rork (Expo) app.

Decide "today" in exactly one place

The first habit to drop is calling new Date().getDate() all over the UI. The "today" you compare against drifts slightly per call site, and around midnight your display and your saved state disagree.

Instead, fold the current instant into a single YYYY-MM-DD string key (a dayKey) through one function that the whole app routes through.

// lib/dayKey.ts
// Pick one "clock" you want content to flip on, and fix it.
// For a Japan-facing daily app, Asia/Tokyo means users abroad
// still see the same "today's card" as everyone at home.
const CONTENT_TZ = "Asia/Tokyo";
 
export function dayKeyFor(date: Date, timeZone: string = CONTENT_TZ): string {
  // Intl gives the calendar date in that timezone, independent of device locale.
  const parts = new Intl.DateTimeFormat("en-CA", {
    timeZone,
    year: "numeric",
    month: "2-digit",
    day: "2-digit",
  }).formatToParts(date);
 
  const get = (t: string) => parts.find((p) => p.type === t)?.value ?? "";
  return `${get("year")}-${get("month")}-${get("day")}`; // e.g. "2026-06-27"
}
 
export function todayKey(timeZone: string = CONTENT_TZ): string {
  return dayKeyFor(new Date(), timeZone);
}

The en-CA locale is deliberate: it yields YYYY-MM-DD natively, so string comparison doubles as date ordering. Any two dayKeys compare lexically, and "2026-06-27" < "2026-06-28" always holds. Content selection, streak logic, and persistence all look only at this string.

Local time, fixed timezone, or server time

Which clock decides "today" depends on the app's character. For an indie app with no backend, asking a server every time is too heavy. Here is a practical split.

BasisBehaviorFitsWeakness
Device local timeFlips at the user's local midnightHabits, journals — the person's own day is the subjectTrusts manual clock changes verbatim
Fixed timezoneAlways flips at one region's midnight"Today's reading from Japan" — the publisher is the subjectLate-night users abroad feel a mismatch
Server timeFlips on an authoritative clockRewards/leaderboards where anti-abuse mattersNo offline, network cost, latency

For the wallpaper and wellness daily apps I run, the content itself carries a sense of "the day," so I anchor on a fixed timezone (Asia/Tokyo). Readers abroad share the same "today's card," and the support thread about "different people see different art" disappeared. A pure habit tracker, by contrast, feels more natural closing on each person's local midnight. Pick one basis and commit; do not build a branch where an empty CONTENT_TZ silently means local. Mixed bases always break later.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
A single dayKey function that no screen bypasses, plus clear criteria for choosing local time, a fixed timezone, or server time
Rollover at midnight that never gets lost, by recomputing on resume instead of trusting a setTimeout that the OS suspends
Detecting a rewound device clock with a monotonic signal so traveling users never double-count or unfairly lose a streak
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

App Dev2026-06-27
Show the In-App 'What's New' Once, Without Nagging — Version Gating and Seen State
An in-app 'What's New' screen that fires on fresh installs or shows every launch gets users annoyed. Here is a version-gated, seen-state design that delivers it exactly once to people who updated — in real Rork (Expo) code, plus a shape you reuse across multiple apps.
App Dev2026-06-27
Before You Ask 'Are You Sure?' — Consider an Undoable Delete
Showing a confirmation dialog every time someone removes a list item trains them to tap OK without reading. Here is how to build an undoable delete in a Rork (Expo) app, and where confirmation dialogs still belong.
App Dev2026-06-27
Your Arabic Users See an Unmirrored Layout — RTL in a Rork (Expo) App and the Reload Trap
You added Arabic to a Rork-generated Expo app, but the screen never flips and the back button stays on the wrong side. The cause is that I18nManager.forceRTL requires a relaunch. This walks through detecting direction with expo-localization, applying it reliably with Updates.reloadAsync, swapping to marginStart, and mirroring only the arrows — all with working code.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →