Skip to content

AboutKotlin/DateTimeRangePicker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DateTimeRangePicker

A date time range picker for android

No start date time and no end date time Pick start date

Pick start time Have start date time and end date time

Usage

With start and end date times specified:

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:

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:

  • showDateTimeRangePickerWithoutStartAndEndDateTimes()
  • showDateTimeRangePickerWithStartAndEndDateTimes()

About

在Kotlin写的android的日期时间范围选择器

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 100.0%