From 214cb7dcc073b2ea0c0f8ed9365f1399d4035c98 Mon Sep 17 00:00:00 2001 From: Zidni Date: Fri, 31 May 2024 14:22:19 +0700 Subject: [PATCH 1/3] fix : style on date in range --- src/components/DaySelector.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/DaySelector.tsx b/src/components/DaySelector.tsx index 622a203..e89f0bd 100644 --- a/src/components/DaySelector.tsx +++ b/src/components/DaySelector.tsx @@ -52,7 +52,7 @@ const DaySelector = () => { ).map((day, index) => { if (day) { let leftCrop = day.dayOfMonth === 1; - let rightCrop = day.dayOfMonth === fullDaysInMonth; + let rightCrop = ((day?.dayOfMonth || 0) - ((day?.dayOfMonth || 0) - day.day)) === fullDaysInMonth; const isFirstDayOfMonth = day.dayOfMonth === 1; const isLastDayOfMonth = day.dayOfMonth === fullDaysInMonth; @@ -79,7 +79,7 @@ const DaySelector = () => { leftCrop = false; } - if (index % 7 === 6 && !selectedEndDay) { + if ((rightCrop || index % 7 === 6) && !selectedEndDay) { rightCrop = false; } From 57b80fdadd01fe87fbf7b64cce13f55cf6158dd9 Mon Sep 17 00:00:00 2001 From: Zidni Date: Mon, 3 Jun 2024 15:34:20 +0700 Subject: [PATCH 2/3] fix : on selected date range part 2 --- src/components/DaySelector.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/DaySelector.tsx b/src/components/DaySelector.tsx index e89f0bd..17d40e3 100644 --- a/src/components/DaySelector.tsx +++ b/src/components/DaySelector.tsx @@ -52,10 +52,10 @@ const DaySelector = () => { ).map((day, index) => { if (day) { let leftCrop = day.dayOfMonth === 1; - let rightCrop = ((day?.dayOfMonth || 0) - ((day?.dayOfMonth || 0) - day.day)) === fullDaysInMonth; + let rightCrop = day.dayOfMonth === fullDaysInMonth; const isFirstDayOfMonth = day.dayOfMonth === 1; - const isLastDayOfMonth = day.dayOfMonth === fullDaysInMonth; + const isLastDayOfMonth = ((day?.dayOfMonth || 0) - ((day?.dayOfMonth || 0) - day.day)) === fullDaysInMonth; const isToday = areDatesOnSameDay(day.date, today); let inRange = false; @@ -79,7 +79,7 @@ const DaySelector = () => { leftCrop = false; } - if ((rightCrop || index % 7 === 6) && !selectedEndDay) { + if (index % 7 === 6 && !selectedEndDay) { rightCrop = false; } From d764f2c78336841ce0b47713515ea45b09a691ee Mon Sep 17 00:00:00 2001 From: Zidni Date: Mon, 3 Jun 2024 17:43:44 +0700 Subject: [PATCH 3/3] fix : style on selected range when start and end is same --- src/components/DaySelector.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/DaySelector.tsx b/src/components/DaySelector.tsx index 17d40e3..23f3fc4 100644 --- a/src/components/DaySelector.tsx +++ b/src/components/DaySelector.tsx @@ -85,7 +85,8 @@ const DaySelector = () => { if ( (isFirstDayOfMonth && selectedEndDay) || - (isLastDayOfMonth && selectedStartDay) + (isLastDayOfMonth && selectedStartDay) || + dayjs(startDate).format('DDMMYYYY') === dayjs(endDate).format('DDMMYYYY') ) { inRange = false; }