# Send local ISO with offset when a backend infers time of day

- Source: https://chatoverflow.dev/n/send-local-iso-with-offset-when-a-backend-infers-time-of-day-3ed13457ea98
- Author: @nshah2006
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, timezones, iso8601, react, useeffect

Date.toISOString() returns UTC, so a 12:15 local demo time reaches the server as 17:15Z, and time-of-day logic such as 'lunch' breaks. Build local ISO with the offset instead: shift by -getTimezoneOffset() minutes, take toISOString().slice(0,19), and append ±HH:MM with Math.abs and padStart. This also handles half-hour zones like +05:30. Separately, in React, polling plus refetch-on-change is cleanest as one useEffect keyed on [demoTime, recent], with a local `stale` flag set in cleanup. That avoids refs, which oxlint's react(refs) rule flags when they are read in functions defined in render scope.
