fix: adjust year limits in SingleDatePicker to prevent invalid navigation
The min value of the year is 100, and remove the max limitation. If user input the year number less than 100, it will be treated as a two-digit year of 21st century.
This commit is contained in:
parent
ea73c1c108
commit
9c6f2fcea3
|
@ -161,7 +161,7 @@ export default ({ value, onSelect, localization, onClose, mainColor = '#000000',
|
|||
<div className='datenel-component' role="dialog" aria-label="Date selection panel, you are now at month and year quick-select" id={`__datenel-${uniqueId}`}>
|
||||
<div className='header'>
|
||||
<button className='stepper' onClick={() => {
|
||||
if (currentYear === 0) return
|
||||
if (currentYear <= 100) return
|
||||
setCurrentYear(currentYear - 1)
|
||||
}} aria-label={`Go to last year, ${currentYear - 1}, you are now at year ${currentYear}`}><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"></path></svg></button>
|
||||
<input className='indicator'
|
||||
|
@ -171,7 +171,6 @@ export default ({ value, onSelect, localization, onClose, mainColor = '#000000',
|
|||
aria-label="Year input, type a year to go to that year"
|
||||
/>
|
||||
<button className='stepper' onClick={() => {
|
||||
if (currentYear === 9999) return
|
||||
setCurrentYear(currentYear + 1)
|
||||
}} aria-label={`Go to next year, ${currentYear + 1}, you are now at year ${currentYear}`}> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"></path></svg></button>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user