@autobusal/common 1.27.1 → 1.27.2
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 +19 -0
- package/Calendar/Calendar.tsx +23 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.27.2
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **A birth date no longer defaults to today.** `Calendar` pre-fills with
|
|
8
|
+
today when given no value, which is right for every other use of it — a
|
|
9
|
+
departure, a report range, a broadcast day — and wrong for exactly one:
|
|
10
|
+
nobody is born today. On the profile-completion form it meant anybody who
|
|
11
|
+
filled in the fields that *looked* empty saved a date of birth of today,
|
|
12
|
+
silently, and that is the field a passenger's age is judged by when they
|
|
13
|
+
book. Reproduced end to end: the row saved `dob = <today>`.
|
|
14
|
+
|
|
15
|
+
`type="dob"` now starts empty so the field reads as unanswered. The picker
|
|
16
|
+
still opens on the current month — `createDate('')` is an Invalid Date and
|
|
17
|
+
the grid built from it renders as nothing — but that anchor is display
|
|
18
|
+
only; what the form submits stays empty until a day is clicked, and
|
|
19
|
+
obtapi's new `required|date_format:d/m/Y|before:today` says so if it is
|
|
20
|
+
left that way.
|
|
21
|
+
|
|
3
22
|
|
|
4
23
|
## 1.27.1
|
|
5
24
|
|
package/Calendar/Calendar.tsx
CHANGED
|
@@ -32,7 +32,24 @@ interface Props {
|
|
|
32
32
|
|
|
33
33
|
const Calendar = ({ type, name, defaultValue, t, validation, minDate, refs, onUpdate, onChange }: Props): JSX.Element => {
|
|
34
34
|
const [ show, setShow ] = useState<boolean>(false);
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Edited: Ferjolt Ozuni - Date: 2026-08-06
|
|
38
|
+
* A BIRTH DATE does not default to today.
|
|
39
|
+
*
|
|
40
|
+
* Defaulting to today is right for every other use of this picker - a
|
|
41
|
+
* departure, a report range, a broadcast day - and wrong for exactly one:
|
|
42
|
+
* nobody is born today. On the profile-completion form it meant anybody
|
|
43
|
+
* who filled in the fields that LOOKED empty saved a date of birth of
|
|
44
|
+
* today, silently, and that is the field a passenger's age is judged by
|
|
45
|
+
* when they book. Reproduced end to end: the row saved dob = today.
|
|
46
|
+
*
|
|
47
|
+
* Empty instead, so the field reads as unanswered and the API's
|
|
48
|
+
* `required|date_format:d/m/Y|before:today` says so if it is left that way.
|
|
49
|
+
*/
|
|
50
|
+
const [ prepared, setPrepared ] = useState<string>(
|
|
51
|
+
defaultValue ?? (type === 'dob' ? '' : prepareDate(new Date()))
|
|
52
|
+
);
|
|
36
53
|
const [ selected, setSelected ] = useState<string>(prepared);
|
|
37
54
|
|
|
38
55
|
const ref = useRef<HTMLDivElement>(null);
|
|
@@ -57,7 +74,11 @@ const Calendar = ({ type, name, defaultValue, t, validation, minDate, refs, onUp
|
|
|
57
74
|
{ show && (
|
|
58
75
|
<Picker
|
|
59
76
|
type={ type }
|
|
60
|
-
|
|
77
|
+
// An empty birth date still needs a month to OPEN on: createDate('')
|
|
78
|
+
// is an Invalid Date and the grid built from it renders as nothing.
|
|
79
|
+
// The anchor is display only - what the form submits stays empty
|
|
80
|
+
// until a day is actually clicked.
|
|
81
|
+
value={ prepared || prepareDate(new Date()) }
|
|
61
82
|
selected={ selected }
|
|
62
83
|
minDate={ minDate }
|
|
63
84
|
t={ t }
|