Skip to content

Commit f33dd22

Browse files
committed
chore(): comments
1 parent dae3c2b commit f33dd22

File tree

1 file changed

+17
-0
lines changed
  • core/src/components/datetime/utils

1 file changed

+17
-0
lines changed

core/src/components/datetime/utils/data.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,17 @@ export const getMonthColumnData = (
342342
return months;
343343
};
344344

345+
/**
346+
* Returns information regarding
347+
* selectable dates (i.e 1st, 2nd, 3rd, etc)
348+
* within a reference month.
349+
* @param locale The locale to format the date with
350+
* @param refParts The reference month/year to generate dates for
351+
* @param minParts The minimum bound on the date that can be returned
352+
* @param maxParts The maximum bound on the date that can be returned
353+
* @param dayValues The allowed date values
354+
* @returns Date data to be used in ion-picker-column-internal
355+
*/
345356
export const getDayColumnData = (
346357
locale: string,
347358
refParts: DatetimeParts,
@@ -352,6 +363,12 @@ export const getDayColumnData = (
352363
const { month, year } = refParts;
353364
const days = [];
354365

366+
/**
367+
* If we have max/min bounds that in the same
368+
* month/year as the refParts, we should
369+
* use the define day as the max/min day.
370+
* Otherwise, fallback to the max/min days in a month.
371+
*/
355372
const numDaysInMonth = getNumDaysInMonth(month, year);
356373
const maxDay = maxParts?.day && maxParts.year === year && maxParts.month === month ? maxParts.day : numDaysInMonth;
357374
const minDay = minParts?.day && minParts.year === year && minParts.month === month ? minParts.day : 1;

0 commit comments

Comments
 (0)