s

    selva

    4 years ago
    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
    anton.bannykh

    anton.bannykh

    4 years ago
    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

    4 years ago
    @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
    anton.bannykh

    anton.bannykh

    4 years ago
    👍
    b

    bissell

    4 years ago
    You may also want to have a look at Klock
    s

    selva

    4 years ago
    @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
    anton.bannykh

    anton.bannykh

    4 years ago
    Sounds about right
    s

    selva

    4 years ago
    @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