https://github.com/skedgo/DateTimeRangePicker
A date time range picker for android written in Kotlin
https://github.com/skedgo/DateTimeRangePicker
Last synced: 21 days 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 (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-06T09:13:02.000Z (over 7 years ago)
- Last Synced: 2025-03-30T02:07:29.675Z (22 days ago)
- Language: Kotlin
- Homepage:
- Size: 261 KB
- Stars: 505
- Watchers: 18
- Forks: 77
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin-android - DateTimeRangePicker - 日期时间范围选择器🔥🔥 (开源库 / UI)
README
# DateTimeRangePicker
[](https://jitpack.io/#skedgo/DateTimeRangePicker)A date time range picker for android
 
 
## 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()`