Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23543] Multi words zones now work while searching for timezones. #25569

Merged
merged 8 commits into from
Aug 29, 2023
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
Loading