Timezone Management
Set the timezone on a RainMaker node so schedules, automations, and time-based features work correctly.
userInstance — ESPRMUser from User sign in.
What This Module Does ?
Sets the node's local time via node.setTimeZone(timezoneString) using IANA identifiers (e.g., "America/New_York").
Use this when the user picks a timezone in settings, you sync timezone across nodes, or time-based automations/schedules are wrong.
Alternatively, set timezone through the Time service — Service Control. Prefer setTimeZone() when you only need timezone, not other service params.
During Provisioning, the SDK may apply the user's timezone to new devices when supported.
Expected outcome: Node timezone updates; time-based behavior uses the new zone.
Common Workflows
Set timezone on one node
await node.setTimeZone("America/Los_Angeles");
Set timezone on all nodes
const { nodes } = await userInstance.getUserNodes();
for (const node of nodes) {
await node.setTimeZone("America/New_York");
}
Sync from user profile
const userTimezone = "Europe/Berlin";
const { nodes } = await userInstance.getUserNodes();
await Promise.all(nodes.map((n) => n.setTimeZone(userTimezone)));
Error Handling
try {
await node.setTimeZone(timeZoneString);
} catch (error) {
console.error("Failed to set timezone:", error);
}
Use valid IANA identifiers; invalid values may be rejected by the backend.
Best Practices
- Set timezone before time-based automations
- Update all nodes when the user changes profile timezone
- Set user timezone before provisioning so new devices inherit it
Related Resource
- API Reference: