Fixed comparing Dates for equality on iOS

This commit is contained in:
dankito 2020-08-31 14:20:43 +02:00
parent 842ff7f0b2
commit 4638de1714
1 changed files with 19 additions and 0 deletions

View File

@ -67,4 +67,23 @@ actual class Date(val date: NSDate) { // cannot subclass NSDate as it's a class
return components.day.toInt() return components.day.toInt()
} }
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is Date) return false
if (date != other.date) return false
return true
}
override fun hashCode(): Int {
return date.hashCode()
}
override fun toString(): String {
return date.description ?: "Date(date=$date)"
}
} }