Expand clock timezone options globally and sort add-item list
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.21 R98";
|
window.CHGRID_WEB_VERSION = "2026.02.21 R99";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -106,15 +106,51 @@ type ChangelogData = {
|
|||||||
const APP_VERSION = String(window.CHGRID_WEB_VERSION ?? '').trim();
|
const APP_VERSION = String(window.CHGRID_WEB_VERSION ?? '').trim();
|
||||||
const DISPLAY_TIME_ZONE = resolveDisplayTimeZone();
|
const DISPLAY_TIME_ZONE = resolveDisplayTimeZone();
|
||||||
const CLOCK_TIME_ZONE_OPTIONS = [
|
const CLOCK_TIME_ZONE_OPTIONS = [
|
||||||
|
'America/Anchorage',
|
||||||
|
'America/Argentina/Buenos_Aires',
|
||||||
|
'America/Chicago',
|
||||||
'America/Detroit',
|
'America/Detroit',
|
||||||
'America/New_York',
|
|
||||||
'America/Indiana/Indianapolis',
|
'America/Indiana/Indianapolis',
|
||||||
|
'America/Halifax',
|
||||||
|
'America/Los_Angeles',
|
||||||
|
'America/St_Johns',
|
||||||
|
'Asia/Bangkok',
|
||||||
|
'Asia/Dhaka',
|
||||||
|
'Asia/Dubai',
|
||||||
|
'Asia/Hong_Kong',
|
||||||
|
'Asia/Kabul',
|
||||||
|
'Asia/Karachi',
|
||||||
|
'Asia/Kathmandu',
|
||||||
|
'Asia/Kolkata',
|
||||||
|
'Asia/Seoul',
|
||||||
|
'Asia/Singapore',
|
||||||
|
'Asia/Tehran',
|
||||||
|
'Asia/Tokyo',
|
||||||
|
'Asia/Yangon',
|
||||||
|
'Atlantic/Azores',
|
||||||
|
'Atlantic/South_Georgia',
|
||||||
|
'Australia/Brisbane',
|
||||||
|
'Australia/Darwin',
|
||||||
|
'Australia/Eucla',
|
||||||
|
'Australia/Lord_Howe',
|
||||||
|
'Europe/Berlin',
|
||||||
|
'Europe/Helsinki',
|
||||||
'America/Kentucky/Louisville',
|
'America/Kentucky/Louisville',
|
||||||
|
'Europe/London',
|
||||||
|
'Europe/Moscow',
|
||||||
|
'Pacific/Auckland',
|
||||||
|
'Pacific/Chatham',
|
||||||
|
'Pacific/Honolulu',
|
||||||
|
'Pacific/Kiritimati',
|
||||||
|
'Pacific/Noumea',
|
||||||
|
'Pacific/Pago_Pago',
|
||||||
|
'Pacific/Apia',
|
||||||
|
'UTC',
|
||||||
] as const;
|
] as const;
|
||||||
dom.appVersion.textContent = APP_VERSION
|
dom.appVersion.textContent = APP_VERSION
|
||||||
? `Another AI experiment with Jage. Version ${APP_VERSION}`
|
? `Another AI experiment with Jage. Version ${APP_VERSION}`
|
||||||
: 'Another AI experiment with Jage. Version unknown';
|
: 'Another AI experiment with Jage. Version unknown';
|
||||||
const ITEM_TYPE_SEQUENCE: ItemType[] = ['radio_station', 'dice', 'wheel', 'clock'];
|
const ITEM_TYPE_SEQUENCE: ItemType[] = ['clock', 'dice', 'radio_station', 'wheel'];
|
||||||
const ITEM_TYPE_GLOBAL_PROPERTIES: Record<ItemType, Record<string, string | number | boolean>> = {
|
const ITEM_TYPE_GLOBAL_PROPERTIES: Record<ItemType, Record<string, string | number | boolean>> = {
|
||||||
radio_station: { emitSound: 'none', useCooldownMs: 1000 },
|
radio_station: { emitSound: 'none', useCooldownMs: 1000 },
|
||||||
dice: { emitSound: 'sounds/roll.ogg', useCooldownMs: 1000 },
|
dice: { emitSound: 'sounds/roll.ogg', useCooldownMs: 1000 },
|
||||||
|
|||||||
@@ -104,6 +104,16 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
- `timeZone`: one of `America/Detroit | America/New_York | America/Indiana/Indianapolis | America/Kentucky/Louisville`.
|
- `timeZone`: one of `America/Detroit | America/New_York | America/Indiana/Indianapolis | America/Kentucky/Louisville`.
|
||||||
|
- `timeZone`: one representative IANA zone per world UTC offset. Includes:
|
||||||
|
`America/Anchorage`, `America/Argentina/Buenos_Aires`, `America/Chicago`, `America/Detroit`,
|
||||||
|
`America/Halifax`, `America/Indiana/Indianapolis`, `America/Kentucky/Louisville`,
|
||||||
|
`America/Los_Angeles`, `America/St_Johns`, `Asia/Bangkok`, `Asia/Dhaka`, `Asia/Dubai`,
|
||||||
|
`Asia/Hong_Kong`, `Asia/Kabul`, `Asia/Karachi`, `Asia/Kathmandu`, `Asia/Kolkata`,
|
||||||
|
`Asia/Seoul`, `Asia/Singapore`, `Asia/Tehran`, `Asia/Tokyo`, `Asia/Yangon`,
|
||||||
|
`Atlantic/Azores`, `Atlantic/South_Georgia`, `Australia/Brisbane`, `Australia/Darwin`,
|
||||||
|
`Australia/Eucla`, `Australia/Lord_Howe`, `Europe/Berlin`, `Europe/Helsinki`,
|
||||||
|
`Europe/London`, `Europe/Moscow`, `Pacific/Apia`, `Pacific/Auckland`, `Pacific/Chatham`,
|
||||||
|
`Pacific/Honolulu`, `Pacific/Kiritimati`, `Pacific/Noumea`, `Pacific/Pago_Pago`, `UTC`.
|
||||||
- `use24Hour`: boolean (or `on/off` in updates), default `false`.
|
- `use24Hour`: boolean (or `on/off` in updates), default `false`.
|
||||||
|
|
||||||
## Packet Shapes
|
## Packet Shapes
|
||||||
|
|||||||
@@ -6,10 +6,46 @@ from typing import Literal
|
|||||||
ItemType = Literal["radio_station", "dice", "wheel", "clock"]
|
ItemType = Literal["radio_station", "dice", "wheel", "clock"]
|
||||||
CLOCK_DEFAULT_TIME_ZONE = "America/Detroit"
|
CLOCK_DEFAULT_TIME_ZONE = "America/Detroit"
|
||||||
CLOCK_TIME_ZONE_OPTIONS: tuple[str, ...] = (
|
CLOCK_TIME_ZONE_OPTIONS: tuple[str, ...] = (
|
||||||
|
"America/Anchorage",
|
||||||
|
"America/Argentina/Buenos_Aires",
|
||||||
|
"America/Chicago",
|
||||||
"America/Detroit",
|
"America/Detroit",
|
||||||
"America/New_York",
|
|
||||||
"America/Indiana/Indianapolis",
|
"America/Indiana/Indianapolis",
|
||||||
|
"America/Halifax",
|
||||||
|
"America/Los_Angeles",
|
||||||
|
"America/St_Johns",
|
||||||
|
"Asia/Bangkok",
|
||||||
|
"Asia/Dhaka",
|
||||||
|
"Asia/Dubai",
|
||||||
|
"Asia/Hong_Kong",
|
||||||
|
"Asia/Kabul",
|
||||||
|
"Asia/Karachi",
|
||||||
|
"Asia/Kathmandu",
|
||||||
|
"Asia/Kolkata",
|
||||||
|
"Asia/Seoul",
|
||||||
|
"Asia/Singapore",
|
||||||
|
"Asia/Tehran",
|
||||||
|
"Asia/Tokyo",
|
||||||
|
"Asia/Yangon",
|
||||||
|
"Atlantic/Azores",
|
||||||
|
"Atlantic/South_Georgia",
|
||||||
|
"Australia/Brisbane",
|
||||||
|
"Australia/Darwin",
|
||||||
|
"Australia/Eucla",
|
||||||
|
"Australia/Lord_Howe",
|
||||||
|
"Europe/Berlin",
|
||||||
|
"Europe/Helsinki",
|
||||||
"America/Kentucky/Louisville",
|
"America/Kentucky/Louisville",
|
||||||
|
"Europe/London",
|
||||||
|
"Europe/Moscow",
|
||||||
|
"Pacific/Auckland",
|
||||||
|
"Pacific/Chatham",
|
||||||
|
"Pacific/Honolulu",
|
||||||
|
"Pacific/Kiritimati",
|
||||||
|
"Pacific/Noumea",
|
||||||
|
"Pacific/Pago_Pago",
|
||||||
|
"Pacific/Apia",
|
||||||
|
"UTC",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -171,10 +171,10 @@ async def test_clock_timezone_update_validates(monkeypatch: pytest.MonkeyPatch)
|
|||||||
|
|
||||||
await server._handle_message(
|
await server._handle_message(
|
||||||
client,
|
client,
|
||||||
json.dumps({"type": "item_update", "itemId": item.id, "params": {"timeZone": "America/New_York"}}),
|
json.dumps({"type": "item_update", "itemId": item.id, "params": {"timeZone": "Europe/Berlin"}}),
|
||||||
)
|
)
|
||||||
assert send_payloads[-1].ok is True
|
assert send_payloads[-1].ok is True
|
||||||
assert item.params.get("timeZone") == "America/New_York"
|
assert item.params.get("timeZone") == "Europe/Berlin"
|
||||||
|
|
||||||
await server._handle_message(
|
await server._handle_message(
|
||||||
client,
|
client,
|
||||||
|
|||||||
Reference in New Issue
Block a user