From 919e078efc05f7066db496652af6f1ba75b2897f Mon Sep 17 00:00:00 2001 From: Joshua Diezmo Date: Thu, 26 Jan 2023 12:10:17 +0800 Subject: [PATCH] Improve year input text --- src/datePicker/components/SelectMonth.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/datePicker/components/SelectMonth.js b/src/datePicker/components/SelectMonth.js index 6ccfa19..b392bb8 100644 --- a/src/datePicker/components/SelectMonth.js +++ b/src/datePicker/components/SelectMonth.js @@ -76,13 +76,19 @@ const SelectMonth = () => { }, [prevDisable, nextDisable]); const onChangeYear = text => { - if (Number(utils.toEnglish(text))) { + if (text === ''){ + setYear(''); + } + else if (Number(utils.toEnglish(text))) { setYear(utils.toPersianNumber(text)); } }; const onSelectYear = number => { let y = Number(utils.toEnglish(year)) + number; + if (y === 0){ + y = new Date().getFullYear(); + } if (y > selectorEndingYear) { y = selectorEndingYear; } else if (y < selectorStartingYear) {