Overview
TheuseTimeZone hook returns the user’s time zone from the host. It is a convenience wrapper around useHostContext.
Wraps onhostcontextchanged
MCP Apps SDK reference
Import
Signature
Returns
IANA time zone string (e.g.,
'America/New_York'). Falls back to the browser’s local time zone when the host does not report one.Usage
McpUiHostContext.timeZone.
The hook re-renders when the host sends a host-context-changed notification. It returns the host’s string without validation, so an invalid value makes Intl constructors throw a RangeError. See MCP App Localization for validation helpers, right-to-left handling, and inspector testing.