{"id":13995319,"url":"https://github.com/AmirShayegh/DatePicker","last_synced_at":"2025-07-22T21:32:38.841Z","repository":{"id":49493533,"uuid":"144069112","full_name":"AmirShayegh/DatePicker","owner":"AmirShayegh","description":"A Date Picker with Calendar for iPhone and iPad Apps.","archived":false,"fork":false,"pushed_at":"2023-06-18T10:14:24.000Z","size":13363,"stargazers_count":205,"open_issues_count":11,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-15T03:13:56.976Z","etag":null,"topics":["cocoapod","cocoapods","date","datepicker","ios","ipad","ipados","iphone","library","picker","swift","swift5"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AmirShayegh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-08-08T21:25:19.000Z","updated_at":"2024-11-08T02:29:07.000Z","dependencies_parsed_at":"2024-01-20T17:53:49.180Z","dependency_job_id":"72c458c3-5a7d-49d5-ad73-9b17b800c40e","html_url":"https://github.com/AmirShayegh/DatePicker","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmirShayegh%2FDatePicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmirShayegh%2FDatePicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmirShayegh%2FDatePicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AmirShayegh%2FDatePicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AmirShayegh","download_url":"https://codeload.github.com/AmirShayegh/DatePicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227177903,"owners_count":17743197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapod","cocoapods","date","datepicker","ios","ipad","ipados","iphone","library","picker","swift","swift5"],"created_at":"2024-08-09T14:03:20.864Z","updated_at":"2024-11-29T17:31:30.660Z","avatar_url":"https://github.com/AmirShayegh.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# DatePicker\n\n[![Version](https://img.shields.io/cocoapods/v/DatePicker.svg?style=flat)](https://cocoapods.org/pods/DatePicker)\n[![License](https://img.shields.io/cocoapods/l/DatePicker.svg?style=flat)](https://cocoapods.org/pods/DatePicker)\n[![Platform](https://img.shields.io/cocoapods/p/DatePicker.svg?style=flat)](https://cocoapods.org/pods/DatePicker)\n### A DatePicker for iOS 10 and Above\n- iPad and iPhone support (popover on ipad, card on iphone)\n- Dark mode support\n- Can personalize colours\n- Easy to use\n\n|![Alt Text](https://github.com/AmirShayegh/DatePicker/blob/master/ReadmeFiles/Full.PNG)|![Alt Text](https://github.com/AmirShayegh/DatePicker/blob/master/ReadmeFiles/Popover.jpg)| ![Alt Text](https://github.com/AmirShayegh/DatePicker/blob/master/ReadmeFiles/DatePicker.gif) |\n|:---:|:---:|:---:|\n| iPhone | iPad | In Action |\n\n## Installation\n\nDatePicker is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'DatePicker', '~\u003e 1.3.0'\n```\n\n## Quick Usage\n\n```swift\nimport DatePicker\n\nclass ViewController: UIViewController {\n    \n    @IBAction func DateButton(_ sender: UIButton) {\n        let minDate = DatePickerHelper.shared.dateFrom(day: 18, month: 08, year: 1990)!\n        let maxDate = DatePickerHelper.shared.dateFrom(day: 18, month: 08, year: 2030)!\n        let today = Date()\n        // Create picker object\n        let datePicker = DatePicker()\n        // Setup\n        datePicker.setup(beginWith: today, min: minDate, max: maxDate) { (selected, date) in\n            if selected, let selectedDate = date {\n                print(selectedDate.string())\n            } else {\n                print(\"Cancelled\")\n            }\n        }\n        // Display\n        datePicker.show(in: self, on: sender)\n    }\n}\n```\n\n## Detailed Usage\n\n1) Import the library\n\n```Swift\nimport UIKit\nimport DatePicker\n\nclass ViewController: UIViewController {\n}\n```\n\n2) Setup\n\nhere are multiple ways to configure DatePicker:\n- Basic - Picker between today and 100 years from now\n```swift\nlet datePicker = DatePicker()\ndatePicker.setup { (selected, date) in\n    if selected, let selectedDate = date {\n        print(\"\\(selectedDate)\"\n    } else {\n        print(\"cancelled\")\n    }\n}\n```\nSet initial selected by setting the `beginWith` parameter:\n```swift\ndatePicker.setup(beginWith: Date()) { (selected, date) in\n            if selected, let selectedDate = date {\n                print(selectedDate.string())\n            } else {\n                print(\"Cancelled\")\n            }\n}\n```\nSet initial selected by setting the `beginWith` parameter:\n```swift\ndatePicker.setup(beginWith: Date()) { (selected, date) in\n            if selected, let selectedDate = date {\n                print(selectedDate.string())\n            } else {\n                print(\"Cancelled\")\n            }\n}\n```\n\n- Picker with minimum and maximum dates\n```swift\ndatePicker.setup(min: minDate, max: maxDate) { (selected, date) in\n    if selected, let selectedDate = date {\n        print(\"\\(selectedDate)\"\n    } else {\n        print(\"cancelled\")\n    }\n}\n```\nSet initial selected by setting the `beginWith` parameter\n```swift\ndatePicker.setup(beginWith: Date(), min: minDate, max: maxDate) { (selected, date) in\n    if selected, let selectedDate = date {\n        print(\"\\(selectedDate)\"\n    } else {\n        print(\"cancelled\")\n    }\n}\n```\nSet initial selected by setting the `beginWith` parameter\n```swift\ndatePicker.setup(beginWith: Date(), min: minDate, max: maxDate) { (selected, date) in\n\tif selected, let selectedDate = date {\n\t\tprint(\"\\(selectedDate)\"\n\t} else {\n\t\tprint(\"cancelled\")\n\t}\n}\n```\n\nYou can also use DatePickerHelper's functions to help generate dates:\n\n```Swift\nlet minDate = DatePickerHelper.shared.dateFrom(day: 18, month: 08, year: 1990)\nlet maxDate = DatePickerHelper.shared.dateFrom(day: 18, month: 08, year: 2020)\n```\n\n- Yearless Picker: select and return day and month integers independent of year. \n\n```Swift\nlet datePicker = DatePicker()\ndatePicker.setupYearless { (selected, month, day) in\n    if selected, let day = day, let month = month {\n        print(\"selected \\(month) \\(day)\")\n        // You can also use DatePickerHelper's functions:\n        // DatePickerHelper.shared.month(number: Int) will return the month string name\n        print(\"selected DatePickerHelper.shared.month(number: month) \\(day)\")\n    } else {\n        print(\"cancelled\")\n    }\n}\n``` \n![Alt Text](https://github.com/AmirShayegh/DatePicker/blob/master/ReadmeFiles/Yearless.png)\n\n3) Display\n\n- Screen Center:\n```Swift\ndatePicker.display(in: self)\n```\n\n- Or as Popover (for iPads):\n```Swift\ndatePicker.displayPopOver(on: button, in: self)\n```\n\n![Alt Text](https://github.com/AmirShayegh/DatePicker/blob/master/ReadmeFiles/Popover.jpg)\n\n## Credit\n- [Designed by Roop Jawl](https://www.linkedin.com/in/roopjawl/)\n- [Developed by Amir Shayegh](https://www.linkedin.com/in/shayegh/)\n\n![Alt Text](https://github.com/AmirShayegh/DatePicker/blob/master/ReadmeFiles/DatePicker.gif)\n\n## License\n\nDatePicker is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAmirShayegh%2FDatePicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAmirShayegh%2FDatePicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAmirShayegh%2FDatePicker/lists"}