( date: CalendarDate, aligned: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null )
| 95 | } |
| 96 | |
| 97 | export function constrainStart( |
| 98 | date: CalendarDate, |
| 99 | aligned: CalendarDate, |
| 100 | duration: DateDuration, |
| 101 | locale: string, |
| 102 | minValue?: DateValue | null, |
| 103 | maxValue?: DateValue | null |
| 104 | ): CalendarDate { |
| 105 | if (minValue && date.compare(minValue) >= 0) { |
| 106 | let newDate = maxDate(aligned, alignStart(toCalendarDate(minValue), duration, locale)); |
| 107 | if (newDate) { |
| 108 | aligned = newDate; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | if (maxValue && date.compare(maxValue) <= 0) { |
| 113 | let newDate = minDate(aligned, alignEnd(toCalendarDate(maxValue), duration, locale)); |
| 114 | if (newDate) { |
| 115 | aligned = newDate; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | return aligned; |
| 120 | } |
| 121 | |
| 122 | export function constrainValue( |
| 123 | date: CalendarDate, |
no test coverage detected