CosmoCalendar icon indicating copy to clipboard operation
CosmoCalendar copied to clipboard

How to disable the past dates from current day?

Open hamza-ahmed opened this issue 7 years ago • 8 comments

hamza-ahmed avatar Jan 25 '18 10:01 hamza-ahmed

Have you found any workaround for this problem?

babarshamsi avatar Mar 23 '18 18:03 babarshamsi

Have you found any workaround for this problem?(2)

devluckman avatar Jan 17 '19 10:01 devluckman

Have you found any workaround for this problem?(3)

LaxmanDroid avatar Apr 24 '19 05:04 LaxmanDroid

Have you found any workaround for this problem?(4)

ienground avatar Apr 28 '19 12:04 ienground

Have you found any workaround for this problem?(5)

nikdevpub avatar Sep 24 '19 15:09 nikdevpub

Have you found any workaround for this problem?(6)

amerelsayed1 avatar Apr 05 '20 22:04 amerelsayed1

private fun disablePastCalendarDays(){
    val c = Calendar.getInstance()

    val disabledDaysSet: MutableSet<Long> = HashSet()
    for (day in c.get(Calendar.DAY_OF_MONTH) downTo 1){
        c.add(Calendar.DATE, -1)
        disabledDaysSet.add(c.timeInMillis)
    }

    schedule_calendar_view.disabledDays = disabledDaysSet
}

nikdevpub avatar Apr 16 '20 10:04 nikdevpub

private fun disablePastCalendarDays(){
    val c = Calendar.getInstance()

    val disabledDaysSet: MutableSet<Long> = HashSet()
    for (day in c.get(Calendar.DAY_OF_MONTH) downTo 1){
        c.add(Calendar.DATE, -1)
        disabledDaysSet.add(c.timeInMillis)
    }

    schedule_calendar_view.disabledDays = disabledDaysSet
}

It works :)

ienground avatar Apr 17 '20 11:04 ienground