private fun Instant.toJsInstant() = InstantJs.ofEpochMilli(toEpochMilliseconds())
private fun InstantJs.toInstant() = Instant.fromEpochMilliseconds(toEpochMilli().toLong())
I created two extension functions but I’m wondering if there is a better way to do that.
d
Dmitry Khalanskiy [JB]
06/21/2023, 8:01 AM
Copy code
private fun Instant.toJsInstant() = InstantJs.ofEpochSecond(epochSeconds, nanosecondsOfSecond)
private fun InstantJs.toInstant() = Instant.fromEpochSeconds(epochSecond().toLong(), nano().toInt())