@autobusal/routes-search 1.1.0 → 1.1.1
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 +31 -0
- package/RoutesSearch.tsx +18 -1
- package/package.json +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@autobusal/routes-search` are documented here. This
|
|
4
|
+
project adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [1.1.1] - 2026-08-01
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **The return date could be set before the departure date.** The picker
|
|
12
|
+
floored at today, so an invalid pair was selectable and only refused by
|
|
13
|
+
an alert after pressing search. It now floors at whatever departure
|
|
14
|
+
currently holds, and follows it when that changes.
|
|
15
|
+
|
|
16
|
+
## [1.1.0] - 2026-07-25
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- **Recovered as canonical source.** This package was published to npm and
|
|
21
|
+
in active use, but had no source anywhere in this monorepo (no
|
|
22
|
+
`packages/routes-search` directory, no git history) - the only copy of its
|
|
23
|
+
code existed as the published npm artifact. Recreated here,
|
|
24
|
+
byte-for-byte identical to the published 1.1.0 tarball (verified via
|
|
25
|
+
`diff` against the installed `node_modules/@autobusal/routes-search`), so it
|
|
26
|
+
can be edited and republished like every other package instead of
|
|
27
|
+
requiring reverse-engineering from `node_modules` or the npm tarball.
|
|
28
|
+
History prior to this point is not recoverable - no git log,
|
|
29
|
+
changelog, or other record of it exists.
|
|
30
|
+
|
|
31
|
+
Authored by Ferjolt Ozuni.
|
package/RoutesSearch.tsx
CHANGED
|
@@ -26,6 +26,12 @@ interface Props {
|
|
|
26
26
|
const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo, babiesNo, t, onSearch }: Props): JSX.Element => {
|
|
27
27
|
const [ selected, setSelected ] = useState<'departure' | 'return'>(type);
|
|
28
28
|
|
|
29
|
+
// Edited: Ferjolt Ozuni - Date: 2026-08-01
|
|
30
|
+
// Tracked in state rather than read from the form, because the return
|
|
31
|
+
// picker's floor has to move the moment the departure date changes -
|
|
32
|
+
// react-hook-form's value alone would not re-render this.
|
|
33
|
+
const [ departureDate, setDepartureDate ] = useState<string>(departure);
|
|
34
|
+
|
|
29
35
|
const { register, handleSubmit, formState: { errors }, setValue } = useForm<RoutesSearchForm>();
|
|
30
36
|
|
|
31
37
|
const { data: CitiesData } = useGetSuggestions();
|
|
@@ -138,7 +144,11 @@ const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo
|
|
|
138
144
|
t={ t }
|
|
139
145
|
validation="required"
|
|
140
146
|
refs={ register }
|
|
141
|
-
onUpdate={
|
|
147
|
+
onUpdate={ ((name, value) => {
|
|
148
|
+
setValue(name, value);
|
|
149
|
+
|
|
150
|
+
setDepartureDate(String(value));
|
|
151
|
+
}) as typeof setValue }
|
|
142
152
|
/>
|
|
143
153
|
|
|
144
154
|
{ Display(errors.departure) }
|
|
@@ -148,10 +158,17 @@ const RoutesSearch = ({ type, from, to, departure, _return, adultsNo, childrenNo
|
|
|
148
158
|
<Item>
|
|
149
159
|
<Title>{ t('routes_search.return', { ns: 'common' }) }</Title>
|
|
150
160
|
|
|
161
|
+
{ /* Edited: Ferjolt Ozuni - Date: 2026-08-01
|
|
162
|
+
The return leg cannot start before the outbound one, so
|
|
163
|
+
the picker floors at whatever departure currently holds.
|
|
164
|
+
It used to floor at today, which let someone pick a
|
|
165
|
+
return before their departure and only told them so with
|
|
166
|
+
an alert after they pressed search. */ }
|
|
151
167
|
<Calendar
|
|
152
168
|
type="picker"
|
|
153
169
|
name="_return"
|
|
154
170
|
defaultValue={ _return }
|
|
171
|
+
minDate={ departureDate }
|
|
155
172
|
t={ t }
|
|
156
173
|
validation="required"
|
|
157
174
|
refs={ register }
|