I am using dynamic type to access KotlinJS Date ja...
# javascript
t
I am using dynamic type to access KotlinJS Date javascript functions like getTimezoneOffset. The method return value is dynamic type. How to convert that to Long for example in efficient manner? dynamicDate.getTimezoneOffset().toString().toLong() is not optimal maybe?
k
1.
x.unsafeCast<Y>()
2.
val r: Y = x
i
@konsoletyper Neither of these will return a correct
Long
!
@tlaukkan However since timezoneoffset is a small number, and it fits in Int, you can use the proposed approach to get
Int
from
dynamic
, if that
dynamic
is really a number.