I want to get the minimum and maximum date from a date picker, but minimum date should be \"- 18\" of the current date and the maximum date should be \"- 100\" of current da
Look at this for Swift version. User negative value (-) to subtract and positive value to add date component.
1. Set minimum date
yourDatePicker.minimumDate = Calendar.current.date(byAdding: .year, value: -1, to: Date())
2. Set maximum date
yourDatePicker.maximumDate = Calendar.current.date(byAdding: .year, value: 1, to: Date())