DateRangePicker is a SwiftUI view that allows users to select a range of dates from a Gregorian calendar in a given interval.
DateRangePicker is not currently compatible with calendars other than the Gregorian calendar. If you need support for other calendars, please open an issue or a pull request.
DateRangePicker is available through Swift Package Manager.
.package(url: "https://github.com/MrAsterisco/DateRangePicker", from: "<see GitHub releases>")
To find out the latest version, look at the Releases tab of this repository.
DateRangePicker can display a calendar with a range of dates selected. It can be used in a form, or as a standalone view.
DateRangePicker(
month: $month, // A binding to control and read the currently visible month.
year: $year, // A binding to control and read the currently visible year.
selection: $range, // The range of dates selected.
minimumDate: <any date>, // The minimum date that can be selected (optional).
maximumDate: <any date> // The maximum date that can be selected (optional).
)
The DateRangePicker selection is represented by an instance of OpenDateInterval
.
ComboPicker requires iOS 15.0 or later.
While compatibility with other platforms is planned, there is no guarantee on when that will be. Each platform handles date pickers differently and requires a different implementation. You are welcome to contribute to this project by adding support for other platforms!
All contributions to expand the library are welcome. Fork the repo, make the changes you want, and open a Pull Request.
If you make changes to the codebase, I am not enforcing a coding style, but I may ask you to make changes based on how the rest of the library is made.
This library is under active development. Even if most of the APIs are pretty straightforward, they may change in the future; but you don't have to worry about that, because releases will follow Semantic Versioning 2.0.0.
DateRangePicker is distributed under the MIT license. See LICENSE for details.