From 658624aaddeae92daef2557ebf31578ad2711c76 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 20 Aug 2024 14:01:04 -0500 Subject: [PATCH] set defaults to match the view Signed-off-by: Matt Bruce --- VDS/Components/DatePicker/DatePickerCalendarModel.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/VDS/Components/DatePicker/DatePickerCalendarModel.swift b/VDS/Components/DatePicker/DatePickerCalendarModel.swift index 16a46e61..da18ab2f 100644 --- a/VDS/Components/DatePicker/DatePickerCalendarModel.swift +++ b/VDS/Components/DatePicker/DatePickerCalendarModel.swift @@ -24,6 +24,8 @@ extension DatePicker { /// All other dates will be active. public let inactiveDates: [Date] + public let selectedDate: Date + /// If provided, the calendar will allow a selection to be made from this date forward. Defaults to today. public let minDate: Date @@ -37,13 +39,15 @@ extension DatePicker { hideCurrentDateIndicator: Bool = false, activeDates: [Date] = [], inactiveDates: [Date] = [], - minDate: Date = Date().startOfMonth, - maxDate: Date = Date().endOfMonth, + selectedDate: Date = Date(), + minDate: Date = Date(), + maxDate: Date = Calendar.current.date(byAdding: .year, value: 10, to: Date())!, indicators: [CalendarBase.CalendarIndicatorModel] = []) { self.hideContainerBorder = hideContainerBorder self.hideCurrentDateIndicator = hideCurrentDateIndicator self.activeDates = activeDates self.inactiveDates = inactiveDates + self.selectedDate = selectedDate self.minDate = minDate self.maxDate = maxDate self.indicators = indicators