Commit 44ae9b8
committed
TimePicker: stop routing UTCDateMini through
Replaces `startOfMinute( inputToDate(...) )` with a small local helper
that mutates the seconds/ms on the `UTCDateMini` directly.
In `date-fns` v4, `startOfMinute` calls `toDate()`, which goes through
`constructFrom()` and does `new input.constructor(value)`. With our
`UTCDateMini` (extends `Date`) plus `timezone-mock` swapping the global
`Date` in tests, that re-construction trips MockDate's "Unhandled type
passed... object" assertion, breaking 50+ DateTimePicker/TimePicker
tests.
Setting seconds and milliseconds via the UTCDateMini's own setSeconds
keeps the truncation in UTC (UTCDateMini's prototype shim reroutes
setSeconds to setUTCSeconds), preserves the existing #15495 behaviour,
and decouples this code path from `date-fns` — useful for future
upgrades.date-fns/startOfMinute
1 parent a766c77 commit 44ae9b8
1 file changed
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
32 | 46 | | |
33 | 47 | | |
34 | 48 | | |
| |||
56 | 70 | | |
57 | 71 | | |
58 | 72 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 73 | + | |
63 | 74 | | |
64 | 75 | | |
65 | 76 | | |
66 | 77 | | |
67 | | - | |
| 78 | + | |
68 | 79 | | |
69 | 80 | | |
70 | 81 | | |
| |||
0 commit comments