https://kotlinlang.org logo
s

selva

06/01/2018, 2:33 PM
Hi Friends, I am upgrading kotlin from 0.9.223 to 1.2.31. After upgrade i am getting an error since kotlin-time split into stdlib and stdlib-js. There is shared code used in JVM and JS modules. But having problem with compiling Date dataype. Since kotlin.js.Date works JS module and java.util.Date works in JVM module. can anyone please help me on this ? Thanks Selva
a

anton.bannykh

06/01/2018, 2:37 PM
Just to clarify: you want to have a
Date
class in the common code, but you'd like it to be represented by
java.util.Date
on JVM and by
kotlin.js.Date
on JS. Is that correct?
If that's the case you might be looking for the
actual typealias
(last sample here: https://kotlinlang.org/docs/reference/multiplatform.html#platform-specific-declarations)
s

selva

06/01/2018, 2:42 PM
@anton.bannykh Yes, because kotlin.js.Date not supported in JVM module and java.util.Date not support JS module. thanks for quick response. Let me take a look at
actualtypealias
a

anton.bannykh

06/01/2018, 2:43 PM
👍
b

bissell

06/01/2018, 2:47 PM
You may also want to have a look at Klock
s

selva

06/01/2018, 2:49 PM
@bissell thanks, exploring it too. thanks
@anton.bannykh currently shared located in JVM module and have symlink pointed to it from JS module. Looks like i need to create multiplatform module for the code to achieve it
a

anton.bannykh

06/01/2018, 4:02 PM
Sounds about right
👍 1
s

selva

06/01/2018, 4:04 PM
@bissell I have tried using klock's DateTime for initializing the date variables. But i have datatype mismatch (DateTime mismatch with TimeStamp and Date) with value assignment from Database.
Error:(257, 33) Kotlin: Type mismatch: inferred type is Date! but DateTime was expected
Error:(20, 28) Kotlin: Type mismatch: inferred type is Date! but DateTime? was expected
2 Views