Merge PR #1728: Use the platform clock for UI timing on the web

Conflicts: docs/ui-parity.md (header change text and change log: union of both sides)
This commit is contained in:
aiongg
2026-10-22 02:35:11 +00:00
3 changed files with 13 additions and 11 deletions
+1 -10
View File
@@ -1287,17 +1287,8 @@ pub fn clean_error(e: &str) -> String {
e.to_string()
}
#[allow(clippy::disallowed_methods)] // the clock is read only off wasm
pub fn now_ms() -> f64 {
#[cfg(not(target_arch = "wasm32"))]
{
use std::time::{SystemTime, UNIX_EPOCH};
SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_secs_f64() * 1000.0).unwrap_or(0.0)
}
#[cfg(target_arch = "wasm32")]
{
0.0
}
gridcraft_engine::core::date::unix_now_ms().unwrap_or(0.0)
}
pub fn cell(r: u32, c: u32) -> CellRef {
+10
View File
@@ -0,0 +1,10 @@
use gridcraft_engine::core::date::unix_now_ms;
#[test]
fn ui_clock_returns_current_unix_milliseconds() {
let before = unix_now_ms().unwrap();
let now = gridcraft_ui_egui::now_ms();
let after = unix_now_ms().unwrap();
assert!(now.is_finite() && now > 0.0);
assert!((before.min(after)..=before.max(after)).contains(&now));
}
+2 -1
View File
@@ -1,6 +1,6 @@
# UI parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (New sheet (+) right after the last sheet tab, #943; next/previous sheet navigation stops at visible-sheet boundaries; Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-19 · **Change:** minor (shared UI clock uses the browser-aware platform clock, #1026; New sheet (+) right after the last sheet tab, #943; next/previous sheet navigation stops at visible-sheet boundaries; Ctrl+Enter fill gives each cell the automatic number format typing gives it; keytip letters typed with Alt held, #1846) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
Interaction, controls and feel, against Excel. Part of [target-app-parity.md](target-app-parity.md).
**UI/UX fidelity: ~55% ready, 50–80 h** (estimated). Ribbon command coverage is measured
@@ -163,6 +163,7 @@ scrollbar bugs 2–4 · pixel/feel pass against observed Excel 7–12.
|---|---|---|
| 2026-10-19 | minor | Ctrl+Enter (`range.fill`) gives each cell what typing the input there gives: a General cell gets the automatic number format (`5%`, `$5`, `3/4/2026`, `=TODAY()`) even when it already held a value, and a cell with its own format, a formatted row or column, or Text keeps it. Cells that held a value used to keep General (`5%` showed 0.05), and empty cells took the active cell's format |
| 2026-10-18 | minor | Keytip letters typed with left Alt held continue the sequence (Alt+H, O, A / Alt+H, O, I ran nothing before: Alt+letter cancelled keytips); other Alt combinations, AltGr and macOS Option are unchanged (#1846) |
| 2026-10-16 | minor | The shared UI clock delegates to the core Unix-millisecond clock, which reads Date.now() on wasm, instead of returning zero there (#1026). Native clock contract tested; browser timing remains unverified |
| 2026-10-12 | minor | Next/previous sheet navigation no longer activates hidden worksheets at either workbook boundary; command tests cover Hidden, VeryHidden and selection retention |
| 2026-10-13 | minor | Sheet tab bar: the tab strip shrinks to its tabs, up to 60% of the bar, so New sheet (+) sits right after the last tab and the horizontal scrollbar takes the rest (part of #943) |
| 2026-10-12 | minor | The File view's recent list tells when each workbook was last changed, read off the UI thread |