Prompt
How do I send push notifications to a user’s local timezone?
Latest observation
To send push notifications at a user’s local time, you generally need to:
- Store the user’s timezone
- Convert the desired send time into each user’s local timezone
- Schedule the notification in your backend/queue for the correct UTC time
- Handle daylight saving time (DST) changes
Basic approach
1) Capture the user’s timezone
When the user signs up or opens the app, determine their IANA timezone string, for example:
America/New_YorkEurope/LondonAsia/Tokyo
In web apps, you can get it with JavaScript:
Intl.DateTimeFormat().resolvedOptions().timeZone
Save this value in your database.
2) Decide the local send rule
Examples:
- “Send every day at 9:00 AM user local time”
- “Send on 2026-01-15 at 6:30 PM local time”
This is a local-time rule, not a UTC time.
3) Convert local time to UTC when scheduling
Use the user’s timezone to convert the desired local time into UTC, then enqueue the push notification for that UTC moment.
Example in JavaScript with Luxon
import { DateTime } from 'luxon';
const userTimeZone = 'America/New_York';
const localSendTime = DateTime.fromObject(
{ year: 2026, month: 1, day: 15, hour: 9, minute: 0 },
{ zone: userTimeZone }
);
const utcTime = localSendTime.toUTC();
console.log(utcTime.toISO());
4) Recompute recurring notifications
If the notification repeats daily/weekly, do not schedule all future sends once and forget them. Timezone and DST shifts can change the actual UTC send time.
Instead:
- calculate the next send time after each send
- or run a scheduler that recalculates daily
Example:
- A 9 AM notification in New York will be at:
- 14:00 UTC during EST
- 13:00 UTC during EDT
Recommended architecture
Option A: Backend scheduler
- Store user timezone
- Store notification rule (“daily at 9 AM”)
- Run a cron/job every minute
- Find due notifications per timezone
- Send push immediately
Good for:
- recurring notifications
- handling DST correctly
- large-scale systems
Option B: Queue with per-user scheduled jobs
- Convert local time to UTC at scheduling time
- Enqueue a delayed job
- On job execution, send push
Good for:
- one-time notifications
- simpler systems
Important DST note
Avoid using fixed offsets like UTC-5, because they break when DST changes.
Use IANA timezones instead:
- ✅
America/Chicago - ❌
UTC-6
If you need to send at “9 AM local time every day”
The safest pattern is:
- Store
timezone = America/Los_Angeles - Each day, compute the next 9 AM in that timezone
- Convert to UTC
- Schedule/send
Quick example flow
If a user in Asia/Kolkata wants a notification at 8:00 PM local time:
- build datetime:
2026-01-15 20:00 Asia/Kolkata - convert to UTC
- schedule send at that UTC time
If you tell me your stack (Node, Python, Firebase, AWS SNS, OneSignal, etc.), I can show you an exact implementation.