@autobusal/common 1.27.3 → 1.27.4

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.27.4
4
+
5
+ ### Fixed
6
+
7
+ - **The calendar allowed a different set of days depending on the visitor's
8
+ timezone.** Day cells are built with `createDate`, which is `Date.UTC(...)`;
9
+ the selectable bounds were built with `new Date(y, m, d)` — *local*
10
+ midnight. Those are not the same instant, so the boundary day fell on
11
+ either side of the limit depending on where the visitor was sitting.
12
+
13
+ The consequence on the money path: **same-day departures were not
14
+ selectable west of Greenwich.** A visitor in New York or Los Angeles could
15
+ not pick today, because local midnight there is *after* the cell's UTC
16
+ midnight, so today's cell tested as below the minimum. Same-day selling was
17
+ deliberately enabled — this had been quietly undoing it for those visitors,
18
+ and it is invisible from Europe. Both sides are UTC now, so the comparison
19
+ is exact and identical everywhere.
20
+
21
+ Found while chasing an apparent off-by-one in the birth-date picker, which
22
+ turned out to be this skew wearing a different hat.
23
+
3
24
  ## 1.27.3
4
25
 
5
26
  ### Fixed
@@ -119,9 +119,25 @@ export const getLimits = (type: ('picker' | 'dob' | 'date')): CalendarLimit => {
119
119
  max: limits.max.year
120
120
  },
121
121
 
122
+ /**
123
+ * Edited: Ferjolt Ozuni - Date: 2026-08-06
124
+ * BUILT IN UTC, because the day cells are.
125
+ *
126
+ * Days.tsx gets each cell's date from `createDate`, which is
127
+ * `Date.UTC(...)` - UTC midnight. These bounds were local midnight, and
128
+ * the two are not the same instant. East of Greenwich local midnight is
129
+ * EARLIER, so the boundary day sat just past the maximum and was greyed
130
+ * out; west of it the boundary day was included instead. The same
131
+ * calendar therefore allowed a different set of days depending on where
132
+ * the visitor was sitting, which is exactly the class of bug the
133
+ * departure floor above was already fixed for once.
134
+ *
135
+ * Same basis on both sides makes the comparison exact and the same
136
+ * everywhere.
137
+ */
122
138
  time: {
123
- min: new Date(today.getFullYear() - limits.min.year, limits.min.month, limits.min.day, 0, 0, 0, 0).getTime(),
124
- max: new Date(today.getFullYear() + limits.max.year, limits.max.month, limits.max.day, 0, 0, 0, 0).getTime()
139
+ min: Date.UTC(today.getFullYear() - limits.min.year, limits.min.month, limits.min.day),
140
+ max: Date.UTC(today.getFullYear() + limits.max.year, limits.max.month, limits.max.day)
125
141
  }
126
142
  };
127
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.27.3",
3
+ "version": "1.27.4",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"