chrono missing wasmbind feature — Calendar panics on WASM #82

Closed
opened 2026-04-20 11:59:36 +00:00 by zaelgohary · 0 comments
Member

chrono is declared in the workspace Cargo.toml with features = ["std", "clock"] and no wasmbind. On wasm32-unknown-unknown, chrono::Local::now() / Utc::now() then falls back to std::time::SystemTime::now() — which WASM doesn't support — and panics:

panicked at '...library/std/src/sys/pal/wasm/../unsupported/time.rs:35:9:
time not implemented on this platform'

The Calendar archipelago hits this immediately on mount (archipelago.rs reads Local::now() to pick the initial date). Any future archipelago using chrono's clock APIs will hit it too.

Fix

Add "wasmbind" to chrono's workspace-level feature list in Cargo.toml. With wasmbind, chrono uses js_sys::Date::now() on WASM instead of SystemTime. js-sys is already a direct workspace dep so no new bloat.

Scope

  • hero_archipelagos/Cargo.toml — add "wasmbind" to the chrono workspace entry.
  • hero_archipelagos/archipelagos/calendar/Cargo.toml — switch from its local override to chrono.workspace = true so it inherits the feature automatically.
`chrono` is declared in the workspace `Cargo.toml` with `features = ["std", "clock"]` and no `wasmbind`. On `wasm32-unknown-unknown`, `chrono::Local::now()` / `Utc::now()` then falls back to `std::time::SystemTime::now()` — which WASM doesn't support — and panics: ``` panicked at '...library/std/src/sys/pal/wasm/../unsupported/time.rs:35:9: time not implemented on this platform' ``` The Calendar archipelago hits this immediately on mount (`archipelago.rs` reads `Local::now()` to pick the initial date). Any future archipelago using chrono's clock APIs will hit it too. ## Fix Add `"wasmbind"` to chrono's workspace-level feature list in `Cargo.toml`. With `wasmbind`, chrono uses `js_sys::Date::now()` on WASM instead of `SystemTime`. `js-sys` is already a direct workspace dep so no new bloat. ## Scope - `hero_archipelagos/Cargo.toml` — add `"wasmbind"` to the chrono workspace entry. - `hero_archipelagos/archipelagos/calendar/Cargo.toml` — switch from its local override to `chrono.workspace = true` so it inherits the feature automatically.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_archipelagos#82
No description provided.