Rob Elliot
09/02/2025, 9:54 AMimport java.time.Period
fun Period.toDays() = when (this) {
Period.ofYears(1) -> 365
Period.ofMonths(1) -> 30
else -> days
}
the check is an equality check, not an identity check, isn't it?
I'm getting a compiler warning Identity-sensitive operation on an instance of value type 'Period' may cause unexpected behavior or errors.
, but surely this is an equality check...Rob Elliot
09/02/2025, 9:54 AMRob Elliot
09/02/2025, 9:56 AM