DatePickerTimeline icon indicating copy to clipboard operation
DatePickerTimeline copied to clipboard

How to disable all the dates after a week from current date

Open ayushchaturvedi opened this issue 5 years ago • 1 comments

ayushchaturvedi avatar May 28 '20 19:05 ayushchaturvedi

I think you can do the calculations yourself.

Here is how i would do it, Create a Calendar.getInstance() Object then using that calendar object, access its time, which will give current date Add seven days from to this current date and pass this as an array object into the deactivateDateMethod or you set it as the initial date. Users wont be able to access the other dates if it is the initial date anyways.

Taking the latter approach in Kotlin,

val cal = Calendar.getInstance() cal.add(cal[Calendar.DAY_OF_YEAR], 7) val dates = arrayOf<Date>(cal.time) datePickerTimeline.setInitialDate( cal[Calendar.YEAR], cal[Calendar.MONTH], cal[Calendar.DAY_OF_MONTH] )

Edited, added actual methods in kotlin

ngacho avatar Jun 09 '20 19:06 ngacho