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

[datetime2] feat(TimezoneSelect): allow filtering by short names #5532

Merged
merged 2 commits into from
Sep 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,14 @@ export class TimezoneSelect extends AbstractPureComponent2<TimezoneSelectProps,
// using list predicate so only one RegExp instance is needed
// escape bad regex characters, let spaces act as any separator
const expr = new RegExp(query.replace(/([[()+*?])/g, "\\$1").replace(" ", "[ _/\\(\\)]+"), "i");
return items.filter(item => expr.test(item.ianaCode) || expr.test(item.label) || expr.test(item.longName));

return items.filter(
item =>
expr.test(item.ianaCode) ||
expr.test(item.label) ||
expr.test(item.longName) ||
expr.test(item.shortName),
);
};

private renderItem: ItemRenderer<TimezoneWithNames> = (item, { handleClick, modifiers }) => {
Expand Down