Skip to content

Commit

Permalink
Merge pull request #17356 from Prince-Mendiratta/year-digits-only
Browse files Browse the repository at this point in the history
[YearPicker] only digits allowed in yearSearchPage
  • Loading branch information
Hayata Suenaga authored Apr 18, 2023
2 parents 509664a + 89dee32 commit 28f8cee
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/pages/YearPickerPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@ class YearPickerPage extends React.Component {
* @param {String} text
*/
filterYearList(text) {
this.setState({
inputText: text,
yearOptions: _.filter(this.yearList, year => year.text.includes(text.trim())),
const searchText = text.replace(CONST.REGEX.NON_NUMERIC, '');
this.setState((prevState) => {
if (searchText === prevState.inputText) {
return {};
}
return {
inputText: searchText,
yearOptions: _.filter(this.yearList, year => year.text.includes(searchText)),
};
});
}

Expand Down

0 comments on commit 28f8cee

Please sign in to comment.