Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skedgo/datetimerangepicker
A date time range picker for android written in Kotlin
https://github.com/skedgo/datetimerangepicker
Last synced: about 23 hours ago
JSON representation
A date time range picker for android written in Kotlin
- Host: GitHub
- URL: https://github.com/skedgo/datetimerangepicker
- Owner: skedgo
- License: mit
- Created: 2016-12-20T16:14:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-06T09:13:02.000Z (about 7 years ago)
- Last Synced: 2024-11-01T20:36:21.830Z (13 days ago)
- Language: Kotlin
- Homepage:
- Size: 261 KB
- Stars: 506
- Watchers: 19
- Forks: 76
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DateTimeRangePicker
[![](https://jitpack.io/v/skedgo/DateTimeRangePicker.svg)](https://jitpack.io/#skedgo/DateTimeRangePicker)A date time range picker for android
![No start date time and no end date time](images/Screenshot_1482250212.png) ![Pick start date](images/Screenshot_1482250219.png)
![Pick start time](images/Screenshot_1482250231.png) ![Have start date time and end date time](images/Screenshot_1482250242.png)
## Usage
Firstly, grab latest release of the library via [JitPack](https://jitpack.io/#skedgo/DateTimeRangePicker). And note that, it utilizes [Joda-Time](https://github.com/dlew/joda-time-android) to process some date time logic under the hood. So you might need to [set up Joda-Time properly](https://github.com/dlew/joda-time-android#usage).With start and end date times specified:
```kotlin
val intent = DateTimeRangePickerActivity.newIntent(
context,
TimeZone.getDefault(),
DateTime.now().millis,
DateTime.now().plusDays(2).millis
)
activity.startActivityForResult(intent, RQC_PICK_DATE_TIME_RANGE)
```Or without start and end date times:
```kotlin
val intent = DateTimeRangePickerActivity.newIntent(
context,
TimeZone.getDefault(),
null, null
)
activity.startActivityForResult(intent, RQC_PICK_DATE_TIME_RANGE)
```At `onActivityResult()`, `DateTimeRangePickerActivity` will return an `Intent` data having following:
* `startTimeInMillis` as `Long`
* `endTimeInMillis` as `Long`
* `timeZone` as `String`## Demo
Run 2 following instrumentation tests on `DateTimeRangePickerActivityTest` to see the 2 usages:
* `withoutStartAndEndDateTimes()`
* `withStartAndEndDateTimes()`