Compare Two Date In Kotlin

You can use the below extension to compare the given date to the current date

fun isDateValid(myDate: String) : Boolean {
    try {
        val date = SimpleDateFormat("yyyy-MM-dd").parse(myDate)
        return !date.before(Date())
    } catch(ignored: java.text.ParseException) {
        return false
    }
}