Repository navigation
Commit 4f56db9
committed
fix(webview): keep two-digit years in McpErrorRow and freeze the spec clock
What: differenceInCalendarDays now copies each input and zeroes it with
setHours(0,0,0,0) instead of rebuilding it through new Date(year, month, day).
The McpErrorRow spec freezes the system clock and gains two cases: the
year-99/100 boundary and a just-after-midnight render.
Why: two review findings, both real and both reproduced before fixing.
1. new Date(year, month, day) maps years 0-99 onto 1900-1999. A date in year 99
was read as 1999, so the year-99/100 boundary produced a delta of 693,959
days instead of 1 and the output degraded to a short date. Verified: the
pre-fix helper returns "12/31/99" where "yesterday at 12:00 PM" is correct.
2. The component formats against the live new Date() while the fixture was
built from the live Date.now(). In the first five minutes after local
midnight the two land on different calendar days, so the /^today at/
assertion failed. Verified by freezing the clock at 00:02 local: the old
assertion fails, and it now passes deterministically.
Impact: no behaviour change outside those two cases. Re-ran the exhaustive
equivalence sweep against date-fns formatRelative: 19,201 hourly samples across
5 timezones, mismatches=0, same as before the fix. Full webview suite 174 files
/ 2,249 tests passed.1 parent 121494d commit 4f56db9
2 files changed
Lines changed: 46 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | | - | |
26 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
48 | 73 | | |
49 | 74 | | |
50 | 75 | | |
51 | 76 | | |
52 | 77 | | |
53 | 78 | | |
54 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
55 | 90 | | |
56 | 91 | | |
57 | 92 | | |
| |||
0 commit comments