Overview
setLocale(tag) sets the language used for month and weekday names, formatLongAgo(), and getMonths(). The tag is a BCP 47 string such as "en", "fr", "de", or "hi". getLocale() returns that tag. With no call yet, mates uses navigator.language, then "en". setLocale(null) clears the override and goes back to that default.
setTimezoneOffset(minutes) stores minutes east of UTC (India is 330, New York standard time is -300) and drops any IANA name. setTimezone(entry) stores both the offset and the IANA name from getAllTimezones(). setTimezone(null) returns to the browser zone.
These setters are module globals. They are not atoms: calling them does not re-render a view by itself. Keep the choice in an atom, call the setter at the start of the template, then read date(). getCalendar weeks always start on Sunday. Day and month labels still follow the locale.
What each setting changes
|
Setting
|
Affects
|
Leaves alone
|
|---|---|---|
setLocale
| Month and weekday names, relative phrases, getMonths() | The instant, and the Sunday-first calendar grid. |
setTimezone
| Wall-clock hour, day boundary, Z/ZZ offset text, isToday | The stored timestamp. ISO from toJSON stays UTC. |
setTimezoneOffset
| The same wall clock, by a fixed minute offset | IANA name. A later setTimezone replaces it. |
Language tag
Switch en, fr, de, and hi. Weekday and month names, and the relative phrase, follow setLocale.
Named zone
Local uses the browser zone. UTC, Kolkata, and New York come from getAllTimezones().