◉RORK LABJP
●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens
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.

Rork622Expo240Date 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-11-16
I Set cameraPermission to false for a Photo Picker, and the QR Scanner Lost Its Camera Too
In expo-image-picker, cameraPermission: false deletes NSCameraUsageDescription from Info.plist on iOS and blocks CAMERA for every package on Android. Here is what happens when you also use expo-camera, and a working script that checks permissions before you submit.
◇ App Dev2026-10-28
"Project is incompatible with this version of Expo Go": Three Places to Check Before Blaming Your Project
When Expo Go says your project needs a newer Expo Go, compare three things before you delete node_modules: the project's SDK, the SDK your Expo Go build includes (the App Store build on a physical iPhone works differently from Android and simulators), and a real mix-up in Android Expo Go 56.0.1. With a symptom-by-symptom table.
◇ App Dev2026-10-22
Expo SDK 58 With Stripe: pod install Stops, and Whether to Turn Off Precompiled Modules or Wait
useFrameworks is already dynamic, yet pod install says Stripe is static and the SDK 58 iOS build stops. The reported conditions, three ways out, and a small script to check your own project first.