Skip to content

Commit

Permalink
DateTimeRangePicker error fix #14600
Browse files Browse the repository at this point in the history
  • Loading branch information
SarveshK16 committed Sep 17, 2024
1 parent eee1c24 commit d94e8be
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,16 @@ export const adjustSectionValue = <TDate extends PickerValidDate, TSection exten
if (newSectionValueNumber > sectionBoundaries.maximum) {
return getCleanValue(
sectionBoundaries.minimum +
((newSectionValueNumber - sectionBoundaries.maximum - 1) %
(sectionBoundaries.maximum - sectionBoundaries.minimum + 1)),
((newSectionValueNumber - sectionBoundaries.maximum - 1) %
(sectionBoundaries.maximum - sectionBoundaries.minimum + 1)),
);
}

if (newSectionValueNumber < sectionBoundaries.minimum) {
return getCleanValue(
sectionBoundaries.maximum -
((sectionBoundaries.minimum - newSectionValueNumber - 1) %
(sectionBoundaries.maximum - sectionBoundaries.minimum + 1)),
((sectionBoundaries.minimum - newSectionValueNumber - 1) %
(sectionBoundaries.maximum - sectionBoundaries.minimum + 1)),
);
}

Expand Down Expand Up @@ -487,9 +487,8 @@ export const getDateFromDateSections = <TDate extends PickerValidDate>(
export const createDateStrForV7HiddenInputFromSections = (sections: FieldSection[]) =>
sections
.map((section) => {
return `${section.startSeparator}${section.value || section.placeholder}${
section.endSeparator
}`;
return `${section.startSeparator}${section.value || section.placeholder}${section.endSeparator
}`;
})
.join('');

Expand Down Expand Up @@ -817,7 +816,8 @@ export const parseSelectedSections = (
}

if (typeof selectedSections === 'string') {
return sections.findIndex((section) => section.type === selectedSections);
const index = sections.findIndex((section) => section.type === selectedSections);
return index === -1 ? null : index;
}

return selectedSections;
Expand All @@ -841,9 +841,9 @@ export const getSectionValueText = <TDate extends PickerValidDate>(
case 'day':
return section.contentType === 'digit'
? utils.format(
utils.setDate(utils.startOfYear(utils.date()), Number(section.value)),
'dayOfMonthFull',
)
utils.setDate(utils.startOfYear(utils.date()), Number(section.value)),
'dayOfMonthFull',
)
: section.value;
case 'weekDay':
// TODO: improve by providing the label of the week day
Expand Down

0 comments on commit d94e8be

Please sign in to comment.