Timezone Management
Timezone management allows you to set and update the timezone for nodes, ensuring proper time-based operations and scheduling.
Overview
Timezone management in RainMaker enables you to:
- Set the timezone for a node
- Update timezone settings
- Ensure proper time synchronization for time-based features
Set Timezone
Set the timezone for a node using the setTimeZone method.
try {
const timeZoneString = "America/Los_Angeles";
const response = await node.setTimeZone(timeZoneString);
console.log("Timezone set successfully:", response);
} catch (error) {
console.error("Error setting timezone:", error);
}
Example: Setting Timezone for Multiple Nodes
You can set timezones for multiple nodes:
try {
const response = await userInstance.getUserNodes();
const timeZoneString = "America/New_York";
for (const node of response.nodes) {
await node.setTimeZone(timeZoneString);
console.log(`Timezone set for node ${node.id}`);
}
} catch (error) {
console.error("Error setting timezones:", error);
}