fix(SW-649): remove superfluous variable

This commit is contained in:
Chuma McPhoy
2024-10-29 12:50:45 +01:00
parent aa20c3569b
commit 6a31aca0b1

View File

@@ -56,7 +56,6 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) {
.reverse() .reverse()
.map((year) => ({ value: year, label: year.toString() })) .map((year) => ({ value: year, label: year.toString() }))
// Get max days based on selected month/year
const daysInMonth = const daysInMonth =
selectedMonth !== null && selectedYear !== null selectedMonth !== null && selectedYear !== null
? dt(`${selectedYear}-${selectedMonth + 1}-01`).daysInMonth() ? dt(`${selectedYear}-${selectedMonth + 1}-01`).daysInMonth()
@@ -82,8 +81,7 @@ export default function DateSelect({ name, registerOptions = {} }: DateProps) {
* must subtract by 1 to get the selected month * must subtract by 1 to get the selected month
*/ */
case DateName.month: case DateName.month:
const monthZeroBased = value - 1 newMonth = value - 1
newMonth = monthZeroBased
setSelectedMonth(newMonth) setSelectedMonth(newMonth)
if (selectedDay) { if (selectedDay) {
const maxDays = dt(`${newYear}-${value}-01`).daysInMonth() const maxDays = dt(`${newYear}-${value}-01`).daysInMonth()