@aquera/nile-elements 2.0.20 → 2.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/README.md +7 -0
  2. package/dist/floating-ui.dom-9df9f37b.cjs.js +2 -0
  3. package/dist/floating-ui.dom-9df9f37b.cjs.js.map +1 -0
  4. package/dist/floating-ui.dom-c4ea6a32.esm.js +1 -0
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.js +598 -488
  8. package/dist/nile-auto-complete/index.cjs.js +1 -1
  9. package/dist/nile-auto-complete/index.esm.js +1 -1
  10. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  11. package/dist/nile-auto-complete/nile-auto-complete.esm.js +1 -1
  12. package/dist/nile-auto-complete/portal-manager.cjs.js +1 -1
  13. package/dist/nile-auto-complete/portal-manager.esm.js +1 -1
  14. package/dist/nile-button/nile-button.cjs.js +1 -1
  15. package/dist/nile-button/nile-button.cjs.js.map +1 -1
  16. package/dist/nile-button/nile-button.css.cjs.js +1 -1
  17. package/dist/nile-button/nile-button.css.cjs.js.map +1 -1
  18. package/dist/nile-button/nile-button.css.esm.js +46 -9
  19. package/dist/nile-button/nile-button.esm.js +6 -6
  20. package/dist/nile-color-picker/index.cjs.js +1 -1
  21. package/dist/nile-color-picker/index.esm.js +1 -1
  22. package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
  23. package/dist/nile-color-picker/nile-color-picker.esm.js +1 -1
  24. package/dist/nile-combobox/index.cjs.js +1 -1
  25. package/dist/nile-combobox/index.esm.js +1 -1
  26. package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
  27. package/dist/nile-combobox/nile-combobox.esm.js +1 -1
  28. package/dist/nile-combobox/portal-manager.cjs.js +1 -1
  29. package/dist/nile-combobox/portal-manager.esm.js +1 -1
  30. package/dist/nile-dropdown/index.cjs.js +1 -1
  31. package/dist/nile-dropdown/index.esm.js +1 -1
  32. package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
  33. package/dist/nile-dropdown/nile-dropdown.esm.js +1 -1
  34. package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
  35. package/dist/nile-dropdown/portal-manager.esm.js +1 -1
  36. package/dist/nile-empty-state/nile-empty-state.cjs.js +1 -1
  37. package/dist/nile-empty-state/nile-empty-state.cjs.js.map +1 -1
  38. package/dist/nile-empty-state/nile-empty-state.esm.js +4 -4
  39. package/dist/nile-markdown-editor/index.cjs.js +1 -1
  40. package/dist/nile-markdown-editor/index.esm.js +1 -1
  41. package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
  42. package/dist/nile-markdown-editor/nile-markdown-editor.esm.js +1 -1
  43. package/dist/nile-popover/index.cjs.js +1 -1
  44. package/dist/nile-popover/index.esm.js +1 -1
  45. package/dist/nile-popover/nile-popover.cjs.js +1 -1
  46. package/dist/nile-popover/nile-popover.esm.js +1 -1
  47. package/dist/nile-popover/portal-manager.cjs.js +1 -1
  48. package/dist/nile-popover/portal-manager.esm.js +1 -1
  49. package/dist/nile-popup/index.cjs.js +1 -1
  50. package/dist/nile-popup/index.esm.js +1 -1
  51. package/dist/nile-popup/nile-popup.cjs.js +1 -1
  52. package/dist/nile-popup/nile-popup.esm.js +1 -1
  53. package/dist/nile-select/index.cjs.js +1 -1
  54. package/dist/nile-select/index.esm.js +1 -1
  55. package/dist/nile-select/nile-select.cjs.js +1 -1
  56. package/dist/nile-select/nile-select.esm.js +1 -1
  57. package/dist/nile-select/portal-manager.cjs.js +1 -1
  58. package/dist/nile-select/portal-manager.esm.js +1 -1
  59. package/dist/nile-side-bar-action/index.cjs.js +1 -1
  60. package/dist/nile-side-bar-action/index.esm.js +1 -1
  61. package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
  62. package/dist/nile-side-bar-action/nile-side-bar-action.esm.js +1 -1
  63. package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
  64. package/dist/nile-side-bar-action/portal-manager.esm.js +1 -1
  65. package/dist/nile-tooltip/index.cjs.js +1 -1
  66. package/dist/nile-tooltip/index.esm.js +1 -1
  67. package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
  68. package/dist/nile-tooltip/nile-tooltip.esm.js +1 -1
  69. package/dist/nile-virtual-select/index.cjs.js +1 -1
  70. package/dist/nile-virtual-select/index.esm.js +1 -1
  71. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  72. package/dist/nile-virtual-select/nile-virtual-select.esm.js +1 -1
  73. package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
  74. package/dist/nile-virtual-select/portal-manager.esm.js +1 -1
  75. package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
  76. package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
  77. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
  78. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
  79. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
  80. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
  81. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +73 -1
  82. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +3 -2
  83. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
  84. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
  85. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
  86. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +1 -1
  87. package/dist/nile-wysiwyg-editor/types.cjs.js +1 -1
  88. package/dist/nile-wysiwyg-editor/types.cjs.js.map +1 -1
  89. package/dist/nile-wysiwyg-editor/types.esm.js +1 -1
  90. package/dist/src/nile-button/nile-button.css.js +46 -9
  91. package/dist/src/nile-button/nile-button.css.js.map +1 -1
  92. package/dist/src/nile-button/nile-button.d.ts +2 -2
  93. package/dist/src/nile-button/nile-button.js +13 -5
  94. package/dist/src/nile-button/nile-button.js.map +1 -1
  95. package/dist/src/nile-button/nile-button.test.js +140 -2
  96. package/dist/src/nile-button/nile-button.test.js.map +1 -1
  97. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-1.test.d.ts +47 -0
  98. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-1.test.js +578 -0
  99. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-1.test.js.map +1 -0
  100. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-2.test.d.ts +3 -0
  101. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-2.test.js +109 -0
  102. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-2.test.js.map +1 -0
  103. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-3.test.d.ts +3 -0
  104. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-3.test.js +356 -0
  105. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-3.test.js.map +1 -0
  106. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-4.test.d.ts +4 -0
  107. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-4.test.js +339 -0
  108. package/dist/src/nile-date-time-picker/nile-date-time-picker.phases-4.test.js.map +1 -0
  109. package/dist/src/nile-date-time-picker/nile-date-time-picker.regressions.test.d.ts +3 -0
  110. package/dist/src/nile-date-time-picker/nile-date-time-picker.regressions.test.js +1472 -0
  111. package/dist/src/nile-date-time-picker/nile-date-time-picker.regressions.test.js.map +1 -0
  112. package/dist/src/nile-date-time-picker/nile-date-time-picker.test-helpers.d.ts +103 -0
  113. package/dist/src/nile-date-time-picker/nile-date-time-picker.test-helpers.js +331 -0
  114. package/dist/src/nile-date-time-picker/nile-date-time-picker.test-helpers.js.map +1 -0
  115. package/dist/src/nile-date-time-picker/nile-date-time-picker.test.d.ts +0 -140
  116. package/dist/src/nile-date-time-picker/nile-date-time-picker.test.js +1 -4495
  117. package/dist/src/nile-date-time-picker/nile-date-time-picker.test.js.map +1 -1
  118. package/dist/src/nile-date-time-picker/nile-date-time-picker.year-handling.test.d.ts +3 -0
  119. package/dist/src/nile-date-time-picker/nile-date-time-picker.year-handling.test.js +1440 -0
  120. package/dist/src/nile-date-time-picker/nile-date-time-picker.year-handling.test.js.map +1 -0
  121. package/dist/src/nile-empty-state/nile-empty-state.d.ts +5 -0
  122. package/dist/src/nile-empty-state/nile-empty-state.js +11 -2
  123. package/dist/src/nile-empty-state/nile-empty-state.js.map +1 -1
  124. package/dist/src/nile-empty-state/nile-empty-state.test.js +31 -0
  125. package/dist/src/nile-empty-state/nile-empty-state.test.js.map +1 -1
  126. package/dist/src/nile-wysiwyg-editor/index.d.ts +2 -1
  127. package/dist/src/nile-wysiwyg-editor/index.js +1 -1
  128. package/dist/src/nile-wysiwyg-editor/index.js.map +1 -1
  129. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +75 -0
  130. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
  131. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +20 -0
  132. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +37 -1
  133. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
  134. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +108 -0
  135. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
  136. package/dist/src/nile-wysiwyg-editor/types.d.ts +8 -0
  137. package/dist/src/nile-wysiwyg-editor/types.js +50 -0
  138. package/dist/src/nile-wysiwyg-editor/types.js.map +1 -1
  139. package/dist/src/version.js +1 -1
  140. package/dist/src/version.js.map +1 -1
  141. package/dist/tsconfig.tsbuildinfo +1 -1
  142. package/package.json +2 -2
  143. package/rollup.config.js +1 -0
  144. package/scripts/component-metrics.mjs +145 -0
  145. package/scripts/merge-coverage.cjs +33 -0
  146. package/src/nile-button/nile-button.css.ts +46 -9
  147. package/src/nile-button/nile-button.test.ts +162 -2
  148. package/src/nile-button/nile-button.ts +13 -4
  149. package/src/nile-date-time-picker/nile-date-time-picker.phases-1.test.ts +607 -0
  150. package/src/nile-date-time-picker/nile-date-time-picker.phases-2.test.ts +112 -0
  151. package/src/nile-date-time-picker/nile-date-time-picker.phases-3.test.ts +389 -0
  152. package/src/nile-date-time-picker/nile-date-time-picker.phases-4.test.ts +329 -0
  153. package/src/nile-date-time-picker/nile-date-time-picker.regressions.test.ts +1618 -0
  154. package/src/nile-date-time-picker/nile-date-time-picker.test-helpers.ts +381 -0
  155. package/src/nile-date-time-picker/nile-date-time-picker.test.ts +1 -4771
  156. package/src/nile-date-time-picker/nile-date-time-picker.year-handling.test.ts +1499 -0
  157. package/src/nile-empty-state/nile-empty-state.test.ts +24 -0
  158. package/src/nile-empty-state/nile-empty-state.ts +12 -2
  159. package/src/nile-wysiwyg-editor/index.ts +2 -1
  160. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +76 -0
  161. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +132 -0
  162. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +40 -1
  163. package/src/nile-wysiwyg-editor/types.ts +52 -0
  164. package/test-timings.json +41 -0
  165. package/vscode-html-custom-data.json +42 -3
  166. package/web-test-runner.config.mjs +72 -2
  167. package/dist/floating-ui.dom-007bbe96.cjs.js +0 -2
  168. package/dist/floating-ui.dom-007bbe96.cjs.js.map +0 -1
  169. package/dist/floating-ui.dom-cc9126da.esm.js +0 -1
@@ -0,0 +1,578 @@
1
+ import { expect } from '@open-wc/testing';
2
+ import { TIMEZONES, utcFromFields } from '../nile-calendar/timezones';
3
+ import './nile-date-time-picker';
4
+ import '../nile-calendar';
5
+ import '../nile-input';
6
+ import { offsetAt, wallAt, parseBracketed, fmtWall, makePicker, apply, checkPayload, roundTrip, instantsFor, findTransitions, runtimeZones, selectAndApply, HOST_TZ, Failures, } from './nile-date-time-picker.test-helpers';
7
+ /*
8
+ * Section K (adversarial audit), part 1 of 4: PHASE 1 (oracle + driver smoke), PHASE 2, FOCUS A/B, PHASE 3.
9
+ * Split out of nile-date-time-picker.test.ts so CI can run it on its own shard;
10
+ * helpers shared across the split files live in nile-date-time-picker.test-helpers.ts.
11
+ */
12
+ /*****************************************************************************
13
+ * SECTION K — ADVERSARIAL AUDIT
14
+ * Merged in from src/_audit/nile-date-time-picker.adversarial.test.ts so the
15
+ * component has a single test file. Original header follows verbatim.
16
+ ****************************************************************************/
17
+ /**
18
+ * ADVERSARIAL AUDIT — nile-date-time-picker (variant="date-time-picker")
19
+ * ============================================================================
20
+ * A single self-contained adversarial suite, consolidated from the 10-file
21
+ * working set. It answers one question: can the component ever silently
22
+ * produce or persist the WRONG INSTANT?
23
+ *
24
+ * Structure:
25
+ * PART 1 independent oracle — Intl `longOffset` + explicit UTC arithmetic
26
+ * PART 2 driver + invariant checker (the PHASE 16 payload contract)
27
+ * PART 3 PHASE 1 oracle validation + driver smoke test
28
+ * PART 4 PHASE 2 year range / calendar arithmetic (+ focused follow-ups)
29
+ * PART 5 PHASE 3 timezone sweep (every runtime zone + static fallback)
30
+ * PART 6 PHASE 4/5 DST transitions, gaps, overlaps
31
+ * PART 7 PHASE 7/8/9/11/12 ms, boundaries, formats, round-trips, fuzzing
32
+ * PART 8 PHASE 6 host-timezone independence digest
33
+ * PART 9 PHASE 10/14/15 UI sequences, Set to now, Apply semantics
34
+ *
35
+ * THE ORACLE RULE: nothing below may validate the component with the
36
+ * component's own helpers. `zoneOffsetMs`, `composeValueISO`, `wallClockInZone`
37
+ * and `wallClockToInstant` are never used to compute an expected value. The
38
+ * oracle reads Intl's PRINTED offset and does its own UTC arithmetic, which is
39
+ * a different mechanism from the implementation's part-differencing.
40
+ *
41
+ * RUNTIME: this is an exhaustive sweep (hundreds of zones, every DST
42
+ * transition, thousands of randomised cases), not a unit suite. See the note
43
+ * at the bottom of this file about keeping it out of the default `yarn test`.
44
+ *
45
+ * Some checks are DIAGNOSTIC: they record current behaviour via console.warn
46
+ * (grep for `[audit-`) rather than asserting a policy. Those are labelled.
47
+ */
48
+ /* ==========================================================================
49
+ PART 1 — INDEPENDENT ORACLE
50
+ (was oracle.ts)
51
+ ========================================================================== */
52
+ /* Wall, offsetAt, wallAt, wallEquals, parseBracketed, fmtWall, wallToUTCms,
53
+ instantsFor, findTransitions, runtimeZones, wallFromUTCms and transitionShape
54
+ now live in nile-date-time-picker.test-helpers.ts (shared with the other split files). */
55
+ /** Temporal, only if the runtime genuinely has it. Never faked. */
56
+ export const TEMPORAL = typeof globalThis.Temporal !== 'undefined' ? globalThis.Temporal : null;
57
+ /* ── D. independent parsers ───────────────────────────────────────────────── */
58
+ /** `...Z` / `...±HH:MM` -> exact instant. Built by hand, not via `new Date`. */
59
+ export function parseInstantString(raw) {
60
+ const m = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,3}))?(Z|[+-]\d{2}:?\d{2})$/
61
+ .exec(raw.trim());
62
+ if (!m)
63
+ return null;
64
+ const [, y, mo, d, h, mi, s, frac, zulu] = m;
65
+ const ms = frac === undefined ? 0 : Number(frac.padEnd(3, '0'));
66
+ const base = utcFromFields(Number(y), Number(mo) - 1, Number(d), Number(h), Number(mi), Number(s ?? 0), ms);
67
+ if (zulu === 'Z')
68
+ return base;
69
+ const om = /^([+-])(\d{2}):?(\d{2})$/.exec(zulu);
70
+ const off = (om[1] === '-' ? -1 : 1) * (Number(om[2]) * 3600000 + Number(om[3]) * 60000);
71
+ return base - off;
72
+ }
73
+ /** Offset-less datetime -> wall clock digits only (no zone applied). */
74
+ export function parseOffsetLess(raw) {
75
+ const m = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?(?:\.(\d{1,3}))?$/.exec(raw.trim());
76
+ if (!m)
77
+ return null;
78
+ const [, y, mo, d, h, mi, s, frac] = m;
79
+ return {
80
+ year: Number(y), month: Number(mo), day: Number(d),
81
+ hours: Number(h), minutes: Number(mi), seconds: Number(s ?? 0),
82
+ // NOTE: read as written, NOT scaled — ".25" is 25ms. Records current intent.
83
+ ms: frac === undefined ? 0 : Number(frac),
84
+ };
85
+ }
86
+ export function isResolvable(zone) {
87
+ try {
88
+ new Intl.DateTimeFormat('en-US', { timeZone: zone });
89
+ return true;
90
+ }
91
+ catch {
92
+ return false;
93
+ }
94
+ }
95
+ /* ==========================================================================
96
+ PART 2 — DRIVER + INVARIANT CHECKER
97
+ (was harness.ts)
98
+ ========================================================================== */
99
+ /* Payload, Violation, makePicker, settle/settle2, applyButton, apply,
100
+ checkPayload, roundTrip, selectAndApply, HOST_TZ and Failures now live in
101
+ nile-date-time-picker.test-helpers.ts. The PART 6 DST helpers (YEAR_FROM,
102
+ YEAR_TO, Tr, allTransitions) moved there too, and mulberry32 is in phases-4. */
103
+ /* ==========================================================================
104
+ PART 3 — PHASE 1: oracle validation + driver smoke test
105
+ (was p1-oracle.test.ts)
106
+ ========================================================================== */
107
+ describe('PHASE 1 — oracle validation', () => {
108
+ it('P1.0 reports the environment (host zone, Temporal, zone count)', () => {
109
+ const zones = runtimeZones();
110
+ // eslint-disable-next-line no-console
111
+ console.warn(`[audit-env] hostTZ=${HOST_TZ} temporal=${TEMPORAL ? 'YES' : 'NO'} ` +
112
+ `zones=${zones.length} ua=${navigator.userAgent.slice(0, 60)}`);
113
+ expect(zones.length, 'runtime must expose a timezone list').to.be.greaterThan(100);
114
+ });
115
+ it('P1.1 offsetAt matches known fixed offsets', () => {
116
+ const t = Date.UTC(2026, 5, 15, 12, 0, 0);
117
+ expect(offsetAt(t, 'UTC')).to.equal(0);
118
+ expect(offsetAt(t, 'Asia/Kolkata')).to.equal(5.5 * 3600000);
119
+ expect(offsetAt(t, 'Asia/Kathmandu')).to.equal(5.75 * 3600000);
120
+ expect(offsetAt(t, 'Australia/Eucla')).to.equal(8.75 * 3600000);
121
+ expect(offsetAt(t, 'Pacific/Kiritimati')).to.equal(14 * 3600000);
122
+ expect(offsetAt(t, 'Pacific/Marquesas')).to.equal(-9.5 * 3600000);
123
+ expect(offsetAt(t, 'America/St_Johns')).to.equal(-2.5 * 3600000); // NDT in June
124
+ });
125
+ it('P1.2 wallAt round-trips against instantsFor on unambiguous times', () => {
126
+ const zones = ['UTC', 'Asia/Kolkata', 'America/New_York', 'Pacific/Auckland', 'Australia/Lord_Howe'];
127
+ for (const z of zones) {
128
+ for (const t of [Date.UTC(2026, 0, 15, 3, 7, 11, 123), Date.UTC(2026, 6, 15, 18, 44, 2, 9)]) {
129
+ const w = wallAt(t, z);
130
+ const back = instantsFor(w, z);
131
+ expect(back, `${z} ${fmtWall(w)}`).to.include(t);
132
+ }
133
+ }
134
+ });
135
+ it('P1.3 instantsFor returns 0 for a gap and 2 for an overlap (New York 2026)', () => {
136
+ const gap = instantsFor({ year: 2026, month: 3, day: 8, hours: 2, minutes: 30, seconds: 0, ms: 0 }, 'America/New_York');
137
+ expect(gap, 'spring-forward 02:30 must not exist').to.have.lengthOf(0);
138
+ const dup = instantsFor({ year: 2026, month: 11, day: 1, hours: 1, minutes: 30, seconds: 0, ms: 0 }, 'America/New_York');
139
+ expect(dup, 'fall-back 01:30 occurs twice').to.have.lengthOf(2);
140
+ expect(dup[1] - dup[0], 'occurrences are 1h apart').to.equal(3600000);
141
+ });
142
+ it('P1.4 Temporal agrees with the oracle — or is explicitly absent (never silent)', () => {
143
+ if (!TEMPORAL) {
144
+ // eslint-disable-next-line no-console
145
+ console.warn('[audit-env] TEMPORAL UNAVAILABLE — P1.4 cross-check NOT PERFORMED. ' +
146
+ 'Oracle rests on Intl longOffset + UTC arithmetic alone.');
147
+ expect(TEMPORAL, 'recorded as not-tested, not as passed').to.equal(null);
148
+ return;
149
+ }
150
+ // Current Temporal: Temporal.TimeZone was removed; zones are plain strings
151
+ // reached through ZonedDateTime. Probe the shape rather than assume it.
152
+ const probe = TEMPORAL.Instant && TEMPORAL.Instant.fromEpochMilliseconds;
153
+ if (!probe) {
154
+ // eslint-disable-next-line no-console
155
+ console.warn('[audit-env] Temporal present but Instant.fromEpochMilliseconds missing — NOT TESTED');
156
+ expect.fail('Temporal present but unusable — investigate rather than silently pass');
157
+ }
158
+ let checked = 0;
159
+ for (const z of ['UTC', 'Asia/Kolkata', 'Asia/Kathmandu', 'America/New_York',
160
+ 'Australia/Lord_Howe', 'Pacific/Chatham', 'Pacific/Kiritimati', 'America/St_Johns']) {
161
+ for (const t of [Date.UTC(2026, 0, 15, 12, 0, 0), Date.UTC(2026, 6, 15, 12, 0, 0)]) {
162
+ const zdt = TEMPORAL.Instant.fromEpochMilliseconds(t).toZonedDateTimeISO(z);
163
+ expect(Number(zdt.offsetNanoseconds) / 1e6, `Temporal vs oracle ${z} @${t}`)
164
+ .to.equal(offsetAt(t, z));
165
+ const w = wallAt(t, z);
166
+ expect(zdt.year, `Temporal year ${z}`).to.equal(w.year);
167
+ expect(zdt.month, `Temporal month ${z}`).to.equal(w.month);
168
+ expect(zdt.day, `Temporal day ${z}`).to.equal(w.day);
169
+ expect(zdt.hour, `Temporal hour ${z}`).to.equal(w.hours);
170
+ expect(zdt.minute, `Temporal minute ${z}`).to.equal(w.minutes);
171
+ checked += 1;
172
+ }
173
+ }
174
+ // eslint-disable-next-line no-console
175
+ console.warn(`[audit-env] Temporal cross-check PERFORMED on ${checked} zone/date pairs`);
176
+ });
177
+ it('P1.5 findTransitions locates the two US 2026 transitions', () => {
178
+ const ts = findTransitions('America/New_York', Date.UTC(2026, 0, 1), Date.UTC(2027, 0, 1));
179
+ expect(ts, 'two transitions in 2026').to.have.lengthOf(2);
180
+ expect(wallAt(ts[0], 'America/New_York').month).to.equal(3);
181
+ expect(wallAt(ts[1], 'America/New_York').month).to.equal(11);
182
+ });
183
+ it('P1.6 independent parsers agree with hand-computed instants', () => {
184
+ expect(parseInstantString('2026-06-15T09:00:00.000Z')).to.equal(Date.UTC(2026, 5, 15, 9, 0, 0, 0));
185
+ expect(parseInstantString('2026-06-15T14:30:00.000+05:30')).to.equal(Date.UTC(2026, 5, 15, 9, 0, 0, 0));
186
+ expect(parseInstantString('2026-06-15T14:30:00.000')).to.equal(null);
187
+ const b = parseBracketed('2026-06-15T14:30:00.000[GMT+05:30 Asia/Kolkata]');
188
+ expect(b.zone).to.equal('Asia/Kolkata');
189
+ expect(b.offsetMs).to.equal(5.5 * 3600000);
190
+ const o = parseOffsetLess('2026-06-15T14:30:00.250');
191
+ expect(o.ms, 'fractional read as written').to.equal(250);
192
+ });
193
+ });
194
+ describe('PHASE 1 — driver smoke test (real component, real Apply)', () => {
195
+ it('P1.7 a Z value applies and yields a self-consistent payload', async () => {
196
+ const el = await makePicker({ value: '2026-06-15T09:00:00.000Z', timezone: 'Asia/Kolkata' });
197
+ const p = await apply(el);
198
+ // eslint-disable-next-line no-console
199
+ console.warn(`[audit-drive] payload=${JSON.stringify({
200
+ value: p.value, unixEpoch: p.unixEpoch, timezone: p.timezone,
201
+ })}`);
202
+ expect(p, 'Apply emitted a payload').to.exist;
203
+ expect(p.unixEpoch, 'instant preserved').to.equal(Date.UTC(2026, 5, 15, 9, 0, 0, 0));
204
+ expect(checkPayload(p, 'Asia/Kolkata'), 'invariant violations').to.deep.equal([]);
205
+ });
206
+ });
207
+ /* ==========================================================================
208
+ PART 4 — PHASE 2: year range and calendar arithmetic
209
+ (was p2-years.test.ts)
210
+ ========================================================================== */
211
+ /** An offset a real tzdb zone could have: |offset| <= 26h, whole minutes. */
212
+ function offsetIsSane(offsetMs) {
213
+ return Number.isFinite(offsetMs) && Math.abs(offsetMs) <= 26 * 3600000 && offsetMs % 60000 === 0;
214
+ }
215
+ const RE_BRACKET = /\[GMT([+-])(\d+):(\d{2})\s+([^\]]+)\]$/;
216
+ function printedOffsetMs(value) {
217
+ const m = RE_BRACKET.exec(value);
218
+ if (!m)
219
+ return null;
220
+ return (m[1] === '-' ? -1 : 1) * (Number(m[2]) * 3600000 + Number(m[3]) * 60000);
221
+ }
222
+ describe('PHASE 2 — year range and calendar arithmetic', () => {
223
+ it('P2.0 finds the lowest year whose emitted offset is still sane (UTC)', async () => {
224
+ const rows = [];
225
+ let firstBad = null;
226
+ for (const y of [1, 50, 100, 200, 500, 1000, 1500, 1600, 1700, 1800, 1850,
227
+ 1875, 1880, 1890, 1900, 1901, 1910, 1950, 2000, 2026, 2100]) {
228
+ const el = await makePicker({});
229
+ const w = { year: y, month: 6, day: 15, hours: 12, minutes: 0, seconds: 0, ms: 0 };
230
+ const p = await selectAndApply(el, w, 'UTC');
231
+ const off = p && p.value ? printedOffsetMs(p.value) : null;
232
+ const sane = off !== null && offsetIsSane(off);
233
+ if (!sane && firstBad === null)
234
+ firstBad = y;
235
+ rows.push(`year=${String(y).padStart(4)} sane=${sane ? 'YES' : 'NO '} ` +
236
+ `printedOffset=${off === null ? 'unparsable' : off / 3600000 + 'h'} ` +
237
+ `epoch=${p && p.unixEpoch} value=${p && p.value}`);
238
+ }
239
+ // eslint-disable-next-line no-console
240
+ console.warn(`[audit-p2] host=${HOST_TZ} emitted-offset sanity by year:\n ${rows.join('\n ')}`);
241
+ expect(rows.length).to.be.greaterThan(0);
242
+ }).timeout(600000);
243
+ it('P2.1 1900-2100 (every year, mid-month) emits sane offsets and round-trips', async () => {
244
+ const f = new Failures();
245
+ let n = 0;
246
+ const subMinute = [];
247
+ for (let y = 1900; y <= 2100; y++) {
248
+ for (const z of ['UTC', 'Asia/Kolkata', 'America/New_York']) {
249
+ const w = { year: y, month: 6, day: 15, hours: 12, minutes: 30, seconds: 15, ms: 250 };
250
+ const insts = instantsFor(w, z);
251
+ if (insts.length !== 1)
252
+ continue;
253
+ // The bracket is `[GMT±hh:mm]`: it cannot carry a historical sub-minute (LMT) offset, so a value in such
254
+ // an era is rounded by design (see FA.1). Skip only those, and pin below that they are all pre-1972.
255
+ if (offsetAt(insts[0], z) % 60000 !== 0) {
256
+ subMinute.push({ y, z });
257
+ continue;
258
+ }
259
+ const el = await makePicker({});
260
+ const p = await selectAndApply(el, w, z);
261
+ const ctx = `year=${y} tz=${z}`;
262
+ f.add(ctx, checkPayload(p, z));
263
+ if (p && p.value) {
264
+ const off = printedOffsetMs(p.value);
265
+ if (off === null || !offsetIsSane(off)) {
266
+ f.add(ctx, [{ code: 'P2_INSANE_OFFSET', detail: `value=${p.value}` }]);
267
+ }
268
+ }
269
+ if (p && p.unixEpoch !== null)
270
+ f.add(ctx, (await roundTrip(p)).violations);
271
+ n += 1;
272
+ }
273
+ }
274
+ // eslint-disable-next-line no-console
275
+ console.warn(`[audit-p2] 1900-2100 probes=${n} skipped(sub-minute offset)=${subMinute.length} violations=${f.count}`);
276
+ expect(f.count, `year-range violations:${f.report()}`).to.equal(0);
277
+ expect(subMinute.every((x) => x.y < 1972), 'only pre-1972 LMT-era instants are exempt').to.be.true;
278
+ expect(n, 'the sweep still covers (nearly) every modern year').to.be.greaterThan(500);
279
+ }).timeout(2400000);
280
+ it('P2.2 month lengths, leap rules, 1900/2000/2100, Jan<->Dec edges', async () => {
281
+ const f = new Failures();
282
+ const cases = [
283
+ [2024, 2, 29, 'leap 2024 valid'], [2000, 2, 29, 'century leap 2000 valid'],
284
+ [2026, 1, 31, '31-day'], [2026, 4, 30, '30-day'], [2026, 2, 28, '28-day'],
285
+ [2026, 12, 31, 'Dec 31'], [2026, 1, 1, 'Jan 1'],
286
+ [1900, 3, 1, '1900 non-leap: Mar 1'], [2100, 3, 1, '2100 non-leap: Mar 1'],
287
+ ];
288
+ for (const [y, mo, d, label] of cases) {
289
+ for (const z of ['UTC', 'Asia/Kolkata']) {
290
+ const w = { year: y, month: mo, day: d, hours: 10, minutes: 0, seconds: 0, ms: 0 };
291
+ const insts = instantsFor(w, z);
292
+ if (insts.length !== 1)
293
+ continue;
294
+ // 1900 Asia/Kolkata is +05:21:10 (LMT): not representable in `[GMT±hh:mm]` (rounded by design, see FA.1).
295
+ // UTC covers the 1900 non-leap case; the Kolkata 1900 row is exempt only for that sub-minute reason.
296
+ if (offsetAt(insts[0], z) % 60000 !== 0) {
297
+ expect(y, 'exempt only for LMT-era years').to.be.lessThan(1972);
298
+ continue;
299
+ }
300
+ const el = await makePicker({});
301
+ const p = await selectAndApply(el, w, z);
302
+ const ctx = `${label} tz=${z} ${fmtWall(w)}`;
303
+ f.add(ctx, checkPayload(p, z));
304
+ if (p && p.unixEpoch !== null) {
305
+ const back = wallAt(p.unixEpoch, z);
306
+ if (back.year !== y || back.month !== mo || back.day !== d) {
307
+ f.add(ctx, [{ code: 'P2_DATE_CHANGED', detail: `got ${back.year}-${back.month}-${back.day}` }]);
308
+ }
309
+ }
310
+ }
311
+ }
312
+ expect(f.count, `calendar violations:${f.report()}`).to.equal(0);
313
+ }).timeout(600000);
314
+ it('P2.3 classifies impossible dates supplied as a value (REJECT/CLAMP/NORMALIZE)', async () => {
315
+ const notes = [];
316
+ for (const raw of ['2026-02-31T10:00:00.000', '2026-02-30', '2025-02-29T10:00:00.000',
317
+ '2026-04-31T10:00:00.000', '2026-00-10T10:00:00.000', '2026-06-00T10:00:00.000']) {
318
+ const el = await makePicker({ value: raw, timezone: 'UTC' });
319
+ const p = await apply(el);
320
+ let cls = 'REJECT(no payload)';
321
+ if (p && p.unixEpoch !== null) {
322
+ const w = wallAt(p.unixEpoch, 'UTC');
323
+ const askedDay = Number(raw.slice(8, 10));
324
+ cls = w.day === askedDay ? 'PRESERVE' : `CLAMP/NORMALIZE -> day ${w.day}`;
325
+ }
326
+ else if (p)
327
+ cls = 'REJECT(null epoch)';
328
+ notes.push(`${raw.padEnd(26)} ${cls.padEnd(28)} value=${p && p.value}`);
329
+ }
330
+ // eslint-disable-next-line no-console
331
+ console.warn(`[audit-p2] impossible-date classification:\n ${notes.join('\n ')}`);
332
+ expect(notes.length).to.equal(6);
333
+ }).timeout(300000);
334
+ });
335
+ /* ==========================================================================
336
+ PART 4b — focused: sub-minute offsets and extreme years
337
+ (was p2b-suboffset.test.ts)
338
+ ========================================================================== */
339
+ describe('FOCUS A — sub-minute zone offsets', () => {
340
+ it('FA.0 measures how many zones have sub-minute offsets, and until when', () => {
341
+ const zones = runtimeZones();
342
+ const offenders = [];
343
+ let latestSubMinute = -Infinity;
344
+ for (const z of zones) {
345
+ // probe one instant per decade 1880..2100
346
+ for (let y = 1880; y <= 2100; y += 10) {
347
+ const t = Date.UTC(y, 5, 15, 12, 0, 0);
348
+ const off = offsetAt(t, z);
349
+ if (off % 60000 !== 0) {
350
+ if (offenders.indexOf(z) === -1)
351
+ offenders.push(z);
352
+ if (t > latestSubMinute)
353
+ latestSubMinute = t;
354
+ }
355
+ }
356
+ }
357
+ // eslint-disable-next-line no-console
358
+ console.warn(`[audit-focusA] zonesWithSubMinuteOffset=${offenders.length}/${zones.length} ` +
359
+ `latestSubMinuteInstant=${latestSubMinute === -Infinity ? 'none' : new Date(latestSubMinute).toISOString()} ` +
360
+ `sample=${offenders.slice(0, 15).join(',')}`);
361
+ expect(zones.length).to.be.greaterThan(0);
362
+ }).timeout(600000);
363
+ it('FA.1 REPRODUCTION: Asia/Kolkata 1900-06-15 12:30:15.250 — value != its own epoch', async () => {
364
+ const z = 'Asia/Kolkata';
365
+ const w = { year: 1900, month: 6, day: 15, hours: 12, minutes: 30, seconds: 15, ms: 250 };
366
+ const el = await makePicker({});
367
+ const p = await selectAndApply(el, w, z);
368
+ expect(p, 'payload').to.exist;
369
+ const epoch = p.unixEpoch;
370
+ const trueOff = offsetAt(epoch, z);
371
+ const viol = checkPayload(p, z);
372
+ // parse the printed bracket independently
373
+ const m = /\[GMT([+-])(\d{2}):(\d{2})\s+([^\]]+)\]$/.exec(p.value);
374
+ const printed = (m[1] === '-' ? -1 : 1) * (Number(m[2]) * 3600000 + Number(m[3]) * 60000);
375
+ const digits = p.value.slice(0, 23);
376
+ const fromValue = Date.parse(digits + 'Z') - printed;
377
+ // does a RELOAD still land on the same epoch?
378
+ const rt = await roundTrip(p);
379
+ // eslint-disable-next-line no-console
380
+ console.warn(`[audit-focusA] REPRO host=${HOST_TZ} tz=${z}\n` +
381
+ ` selected = ${fmtWall(w)}\n` +
382
+ ` unixEpoch = ${epoch}\n` +
383
+ ` true offset = ${trueOff}ms (${trueOff / 60000} min, i.e. ${trueOff / 1000}s)\n` +
384
+ ` printed offset= ${printed}ms (${printed / 60000} min)\n` +
385
+ ` offset lost = ${trueOff - printed}ms\n` +
386
+ ` emitted value = ${p.value}\n` +
387
+ ` value resolves to ${fromValue} (delta vs epoch = ${fromValue - epoch}ms)\n` +
388
+ ` reload epoch = ${rt.second && rt.second.unixEpoch} ` +
389
+ `(${rt.second && rt.second.unixEpoch === epoch ? 'PRESERVED' : 'DRIFTED'})\n` +
390
+ ` violations = ${viol.map(v => v.code).join(',') || 'none'}`);
391
+ expect(trueOff % 60000, 'this zone/date genuinely has a sub-minute offset').to.not.equal(0);
392
+ expect(fromValue - epoch, 'the emitted value does NOT describe its own epoch').to.not.equal(0);
393
+ }).timeout(300000);
394
+ // Start at 1972: Africa/Monrovia genuinely used -00:44:30 until 1972-01-07, so 1970-71 is not 'modern' (tzdata history).
395
+ it('FA.2 modern era (1972-2100) has NO sub-minute offsets in any zone', () => {
396
+ const zones = runtimeZones();
397
+ const bad = [];
398
+ for (const z of zones) {
399
+ for (let y = 1972; y <= 2100; y += 5) {
400
+ for (const mo of [0, 6]) {
401
+ const off = offsetAt(Date.UTC(y, mo, 15, 12), z);
402
+ if (off % 60000 !== 0)
403
+ bad.push(`${z}@${y}-${mo + 1}`);
404
+ }
405
+ }
406
+ }
407
+ // eslint-disable-next-line no-console
408
+ console.warn(`[audit-focusA] modern-era sub-minute offsets=${bad.length} ${bad.slice(0, 10).join(',')}`);
409
+ expect(bad, 'no modern zone has a sub-minute offset').to.deep.equal([]);
410
+ }).timeout(600000);
411
+ });
412
+ describe('FOCUS B — extreme years through the Z-instant path', () => {
413
+ it('FB.1 records emitted offset sanity for extreme years (no harness Date() involved)', async () => {
414
+ const rows = [];
415
+ for (const raw of [
416
+ '0001-01-01T00:00:00.000Z', '0100-06-15T12:00:00.000Z', '1000-06-15T12:00:00.000Z',
417
+ '1700-06-15T12:00:00.000Z', '1900-06-15T12:00:00.000Z', '2026-06-15T12:00:00.000Z',
418
+ '2100-06-15T12:00:00.000Z', '9999-12-31T23:59:59.999Z',
419
+ ]) {
420
+ const el = await makePicker({ value: raw, timezone: 'UTC' });
421
+ const p = await apply(el);
422
+ const m = p && p.value ? /\[GMT([+-])(\d+):(\d{2})/.exec(p.value) : null;
423
+ const hours = m ? Number(m[2]) : NaN;
424
+ rows.push(`${raw} -> epoch=${p && p.unixEpoch} offsetHours=${m ? (m[1] + String(hours)) : 'n/a'} ` +
425
+ `${Number.isFinite(hours) && hours > 26 ? '<<< INSANE' : ''} value=${p && p.value}`);
426
+ }
427
+ // eslint-disable-next-line no-console
428
+ console.warn(`[audit-focusB] extreme-year Z inputs:\n ${rows.join('\n ')}`);
429
+ expect(rows.length).to.equal(8);
430
+ }).timeout(300000);
431
+ it('FB.2 records the component date-only path for 2-digit-looking years', async () => {
432
+ const rows = [];
433
+ for (const raw of ['0050-06-15', '0099-06-15', '0100-06-15', '1950-06-15']) {
434
+ const el = await makePicker({ value: raw, timezone: 'UTC' });
435
+ const p = await apply(el);
436
+ const w = p && p.unixEpoch !== null ? wallAt(p.unixEpoch, 'UTC') : null;
437
+ rows.push(`${raw} -> epoch=${p && p.unixEpoch} readsBackAsYear=${w && w.year} value=${p && p.value}`);
438
+ }
439
+ // eslint-disable-next-line no-console
440
+ console.warn(`[audit-focusB] date-only low years (component path):\n ${rows.join('\n ')}`);
441
+ expect(rows.length).to.equal(4);
442
+ }).timeout(300000);
443
+ });
444
+ /* ==========================================================================
445
+ PART 5 — PHASE 3: timezone sweep
446
+ (was p3-zones.test.ts)
447
+ ========================================================================== */
448
+ const NAMED = [
449
+ 'UTC', 'Asia/Kolkata', 'Asia/Calcutta', 'Asia/Kathmandu', 'Australia/Eucla',
450
+ 'Australia/Lord_Howe', 'America/St_Johns', 'America/New_York', 'Europe/London',
451
+ 'Pacific/Auckland', 'Pacific/Kiritimati', 'Pacific/Marquesas',
452
+ ];
453
+ // Representative wall clocks across the year, with awkward ms/seconds.
454
+ const PROBES = [
455
+ { year: 2026, month: 1, day: 15, hours: 9, minutes: 30, seconds: 0, ms: 0 },
456
+ { year: 2026, month: 7, day: 15, hours: 14, minutes: 45, seconds: 7, ms: 123 },
457
+ { year: 2026, month: 10, day: 31, hours: 23, minutes: 59, seconds: 59, ms: 999 },
458
+ ];
459
+ async function probeZone(zone, w, f) {
460
+ const el = await makePicker({});
461
+ const p = await selectAndApply(el, w, zone);
462
+ const ctx = `tz=${zone} want=${fmtWall(w)} host=${HOST_TZ}`;
463
+ f.add(ctx, checkPayload(p, zone));
464
+ if (!p || p.unixEpoch === null) {
465
+ f.add(ctx, [{ code: 'NO_EPOCH', detail: 'apply produced none' }]);
466
+ return;
467
+ }
468
+ const rt = await roundTrip(p);
469
+ f.add(`${ctx} value=${p.value}`, rt.violations);
470
+ }
471
+ describe('PHASE 3 — timezone sweep', () => {
472
+ it('P3.0 records both zone sources and their divergence (diagnostic, no spelling assumed)', () => {
473
+ const runtime = runtimeZones();
474
+ const onlyRuntime = runtime.filter(z => TIMEZONES.indexOf(z) === -1);
475
+ const onlyStatic = TIMEZONES.filter(z => runtime.indexOf(z) === -1);
476
+ const unresolvableStatic = TIMEZONES.filter(z => !isResolvable(z));
477
+ // eslint-disable-next-line no-console
478
+ console.warn(`[audit-p3] host=${HOST_TZ} runtimeZones=${runtime.length} staticList=${TIMEZONES.length} ` +
479
+ `onlyRuntime=${onlyRuntime.length} onlyStatic=${onlyStatic.length} ` +
480
+ `staticUnresolvableByIntl=${unresolvableStatic.length} ` +
481
+ `india(runtime)=${runtime.filter(z => /Kolkata|Calcutta/.test(z)).join('|')} ` +
482
+ `india(static)=${TIMEZONES.filter(z => /Kolkata|Calcutta/.test(z)).join('|')}`);
483
+ expect(runtime.length, 'runtime exposes a zone list').to.be.greaterThan(100);
484
+ // Any static-list entry Intl cannot resolve would be offered by the legacy
485
+ // fallback dropdown yet rejected by isValidTimezone — record it explicitly.
486
+ expect(unresolvableStatic, 'static fallback entries Intl rejects').to.deep.equal([]);
487
+ });
488
+ it('P3.1 explicitly named zones round-trip with no invariant violation', async () => {
489
+ const f = new Failures();
490
+ for (const z of NAMED)
491
+ for (const w of PROBES)
492
+ await probeZone(z, w, f);
493
+ expect(f.count, `named-zone violations:${f.report()}`).to.equal(0);
494
+ }).timeout(180000);
495
+ it('P3.2 EVERY runtime zone round-trips (one probe each)', async () => {
496
+ const f = new Failures();
497
+ const zones = runtimeZones();
498
+ let n = 0;
499
+ for (const z of zones) {
500
+ await probeZone(z, PROBES[1], f);
501
+ n += 1;
502
+ }
503
+ // eslint-disable-next-line no-console
504
+ console.warn(`[audit-p3] swept ${n} zones, violations=${f.count}`);
505
+ expect(f.count, `all-zone violations:${f.report()}`).to.equal(0);
506
+ }).timeout(900000);
507
+ it('P3.3 a valid alias is never silently downgraded to UTC', async () => {
508
+ const f = new Failures();
509
+ const aliases = [
510
+ ['Asia/Calcutta', 'Asia/Kolkata'], ['Asia/Saigon', 'Asia/Ho_Chi_Minh'],
511
+ ['Europe/Kiev', 'Europe/Kyiv'], ['America/Godthab', 'America/Nuuk'],
512
+ ['Asia/Rangoon', 'Asia/Yangon'], ['Pacific/Ponape', 'Pacific/Pohnpei'],
513
+ ];
514
+ for (const [alias, canonical] of aliases) {
515
+ let resolvable = true;
516
+ try {
517
+ new Intl.DateTimeFormat('en-US', { timeZone: alias });
518
+ }
519
+ catch {
520
+ resolvable = false;
521
+ }
522
+ if (!resolvable)
523
+ continue;
524
+ const w = PROBES[1];
525
+ const el = await makePicker({});
526
+ const p = await selectAndApply(el, w, alias);
527
+ const ctx = `alias=${alias} canonical=${canonical}`;
528
+ f.add(ctx, checkPayload(p));
529
+ if (p && p.unixEpoch !== null) {
530
+ // the epoch must match the canonical zone's resolution, never UTC's
531
+ const el2 = await makePicker({});
532
+ const pc = await selectAndApply(el2, w, canonical);
533
+ if (pc && pc.unixEpoch !== p.unixEpoch) {
534
+ f.add(ctx, [{ code: 'ALIAS_EPOCH_DIVERGES', detail: `alias=${p.unixEpoch} canonical=${pc.unixEpoch}` }]);
535
+ }
536
+ if (offsetAt(p.unixEpoch, alias) === 0 && offsetAt(p.unixEpoch, canonical) !== 0) {
537
+ f.add(ctx, [{ code: 'ALIAS_DOWNGRADED_TO_UTC', detail: `value=${p.value}` }]);
538
+ }
539
+ }
540
+ }
541
+ expect(f.count, `alias violations:${f.report()}`).to.equal(0);
542
+ }).timeout(180000);
543
+ it('P3.5 EVERY static-fallback zone round-trips (legacy dropdown path)', async () => {
544
+ const f = new Failures();
545
+ let n = 0;
546
+ for (const z of TIMEZONES) {
547
+ if (!isResolvable(z))
548
+ continue;
549
+ await probeZone(z, PROBES[1], f);
550
+ n += 1;
551
+ }
552
+ // eslint-disable-next-line no-console
553
+ console.warn(`[audit-p3] swept ${n} static-fallback zones, violations=${f.count}`);
554
+ expect(f.count, `static-list violations:${f.report()}`).to.equal(0);
555
+ }).timeout(900000);
556
+ it('P3.4 sub-hour zones (:30 / :45 / :15) keep exact offsets', async () => {
557
+ const f = new Failures();
558
+ for (const z of ['Asia/Kolkata', 'Asia/Kathmandu', 'Australia/Eucla',
559
+ 'America/St_Johns', 'Pacific/Chatham', 'Pacific/Marquesas', 'Australia/Lord_Howe']) {
560
+ for (const w of PROBES) {
561
+ const el = await makePicker({});
562
+ const p = await selectAndApply(el, w, z);
563
+ const ctx = `subhour tz=${z} want=${fmtWall(w)}`;
564
+ f.add(ctx, checkPayload(p, z));
565
+ if (p && p.unixEpoch !== null) {
566
+ const off = offsetAt(p.unixEpoch, z);
567
+ if (off % 3600000 === 0 && ['Asia/Kolkata', 'Asia/Kathmandu'].indexOf(z) !== -1) {
568
+ f.add(ctx, [{ code: 'SUBHOUR_LOST', detail: `offset became whole hours: ${off}` }]);
569
+ }
570
+ const rt = await roundTrip(p);
571
+ f.add(ctx, rt.violations);
572
+ }
573
+ }
574
+ }
575
+ expect(f.count, `sub-hour violations:${f.report()}`).to.equal(0);
576
+ }).timeout(300000);
577
+ });
578
+ //# sourceMappingURL=nile-date-time-picker.phases-1.test.js.map