How many days until

Report a typo

The function daysDifference(date1: String, date2: String): Int, where date1 and date2 are ISO 8601 strings representing dates (for example., 2012-07-23), returns the absolute value of the days difference between date1 and date2 (always positive).

Write the correct code for the daysDifference() function.

This task uses dependencies that may not be available in your local IDE. As a result, you may see compilation errors or unresolved references when running the code locally. This does not affect solution validation when you submit your solution to Hyperskill.

Sample Input 1:

2000-04-11
1999-09-22

Sample Output 1:

202
Write a program in Kotlin
import kotlinx.datetime.*

fun daysDifference(date1: String, date2: String): Int {
// Write your code here

//
}

fun main() {
val date1 = readln()
val date2 = readln()
println(daysDifference(date1, date2))
}

Create a free account to access the full topic