Skip to content

Commit

Permalink
Merge pull request #25569 from DanutGavrus/fix/23543-multi-words-time…
Browse files Browse the repository at this point in the history
…zones-search

[23543] Multi words zones now work while searching for timezones.
  • Loading branch information
bondydaa authored Aug 29, 2023
2 parents d9877e4 + e747c1c commit ff5f960
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/pages/settings/Profile/TimezoneSelectPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,19 @@ function TimezoneSelectPage(props) {
*/
const filterShownTimezones = (searchText) => {
setTimezoneInputText(searchText);
setTimezoneOptions(_.filter(allTimezones.current, (tz) => tz.text.toLowerCase().includes(searchText.trim().toLowerCase())));
const searchWords = searchText.toLowerCase().match(/[a-z0-9]+/g) || [];
setTimezoneOptions(
_.filter(allTimezones.current, (tz) =>
_.every(
searchWords,
(word) =>
tz.text
.toLowerCase()
.replace(/[^a-z0-9]/g, ' ')
.indexOf(word) > -1,
),
),
);
};

return (
Expand Down

0 comments on commit ff5f960

Please sign in to comment.