abdullah-original/ExtendedDatePicker
SwiftUI date picker with multiple modes
Installation
ExtendedDatePicker is available to be installed in your app via Swift Package Manager using the git url https://github.com/abdullah-original/ExtendedDatePicker.git.
Both a static and a dynamic library are provided.
Usage
ExtendedDatePicker(
selectedDate: Binding<Date>,
dateRange: ClosedRange<Date>,
mode: DateMode,
calendar: Calendar,
options: ExtendedDatePickerOptions
)Initialize the date picker as above. If you want to provide a custom locale or timezone, do so via the calendar parameter, otherwise the the default will be used.
In addition, some UI elements (such as back and forward arrows) can be customized using options: ExtendedDatePickerOptions parameter.
The client must provide at least selectedDate, dateRange, mode parameters. selectedDate is the state object that keeps track of currently selected date by user.
Info about date modes:
week: If the user has selected 2-8 February 2024, for example,selectedDatewould be2-2-2024.monthYear: If the user has selected February 2024, for example,selectedDatewould bex-2-2024. No guarantees are made aboutx.year: If the user has selected 2024, for example,selectedDatewould bex-y-2024. No guarantees are made aboutxory.
In monthYear or year mode, client should just extract the relevent component from selectedDate i.e. calendar.component(.year, from: selectedDate).
Feedback
If you have any feedback or improvements to suggest, please free to open an issue.
Package Metadata
Repository: abdullah-original/ExtendedDatePicker
Stars: 8
Forks: 1
Open issues: 0
Default branch: main
Primary language: swift
License: GPL-3.0
Topics: calendar, datepicker, ios, macos, swift, swiftui, uidatepicker, uikit, xcode
README: README.md