Skip to content

Commit

Permalink
fix: max date bug dateinput (#4674)
Browse files Browse the repository at this point in the history
  • Loading branch information
lisalupi authored Jan 29, 2025
1 parent d44d0dc commit d3acc50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-pugs-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ultraviolet/ui": patch
---

`<DateInput />: fix issue with min-max date
7 changes: 2 additions & 5 deletions packages/ui/src/components/DateInput/components/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,7 @@ const PopupContent = () => {
sentiment="neutral"
size="xsmall"
onClick={() => {
if (
!maxDate ||
maxDate >= new Date(yearToShow, monthToShow + 1, 1)
) {
if (!maxDate || maxDate >= new Date(yearToShow, monthToShow, 1)) {
if (!showMonthYearPicker) {
const [monthNext, year] = getNextMonth(monthToShow, yearToShow)
setMonthToShow(monthNext)
Expand All @@ -118,7 +115,7 @@ const PopupContent = () => {
}
}}
disabled={
!!(maxDate && maxDate < new Date(yearToShow, monthToShow + 1, 1))
!!(maxDate && maxDate < new Date(yearToShow, monthToShow, 1))
}
/>
</Stack>
Expand Down

0 comments on commit d3acc50

Please sign in to comment.