-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Changes from 1 commit
2657fa2
ba70e32
757b43c
da64640
6d85f2a
d2d6b70
818877c
e747c1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,13 @@ function TimezoneSelectPage(props) { | |
*/ | ||
const filterShownTimezones = (searchText) => { | ||
setTimezoneInputText(searchText); | ||
setTimezoneOptions(_.filter(allTimezones.current, (tz) => tz.text.toLowerCase().includes(searchText.trim().toLowerCase()))); | ||
setTimezoneOptions(_.filter(allTimezones.current, (tz) => { | ||
let shouldShow = true; | ||
searchText.toLowerCase().replace(/[^a-z0-9]/g, ' ').split(' ').forEach((word) => { | ||
if (tz.text.toLowerCase().replace(/[^a-z0-9]/g, ' ').indexOf(word) < 0) shouldShow = false; | ||
}) | ||
return shouldShow; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a lint here. Can't we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run |
||
})); | ||
}; | ||
|
||
return ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can sanitize the searchText before checking :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we keep the current regex, this won't be needed, otherwise, I'll update as suggested.