◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
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.

Rork585Expo219Date handlingStreaksRetention design

✦ 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-09-18
The three lines I check when prebuild stops on the standard SDK 57 Swift AppDelegate error
Turning on ios.enableSceneSupport for iOS 27 can stop prebuild cold. The cause was not my SDK version but the shape of AppDelegate.swift. Here are the three lines to check, and why copying the SDK 58 migration steps by hand will break your build.
◇ App Dev2026-09-16
The Token I Deleted Came Back After a Restart — Detecting Failed SecureStore Deletes
On Android, getItemAsync can report null right after sign-out while the value is still sitting on disk. Here is how I rewrote a sign-out path that was verifying deletion by reading instead of by the delete result.
◇ App Dev2026-09-10
Your First EAS Workflow in a Rork Repo, and the Alert That Goes Missing Exactly When You Need It
Putting two files into .eas/workflows in a repo exported from Rork, and why a notification wired with needs stays silent on exactly the nights it fails — with the output of a small local checker I actually ran.