From 00b61c29cff0640821822e75a45fb77a1fb5b2bf Mon Sep 17 00:00:00 2001 From: Michael Jordan Date: Thu, 26 Oct 2023 15:36:30 +0100 Subject: [PATCH] Fix preparing timezones for date library. --- shared/build.gradle.kts | 5 +++++ .../bumble/livemosaic/participant/prepareTimeZones.kt | 4 ++++ .../kotlin/com/bumble/livemosaic/participant/Clock.kt | 1 + .../bumble/livemosaic/participant/PrepareTimeZones.kt | 3 +++ .../bumble/livemosaic/participant/prepareTimeZones.kt | 4 ++++ .../bumble/livemosaic/participant/prepareTimeZones.kt | 10 ++++++++++ 6 files changed, 27 insertions(+) create mode 100644 shared/src/androidMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt create mode 100644 shared/src/commonMain/kotlin/com/bumble/livemosaic/participant/PrepareTimeZones.kt create mode 100644 shared/src/desktopMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt create mode 100644 shared/src/jsMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 9b2cec9a..8c699376 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -44,6 +44,11 @@ kotlin { implementation(kotlin("test")) } } + val jsMain by getting { + dependencies { + implementation(npm("@js-joda/timezone", "2.3.0")) + } + } } } diff --git a/shared/src/androidMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt b/shared/src/androidMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt new file mode 100644 index 00000000..9cc06a67 --- /dev/null +++ b/shared/src/androidMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt @@ -0,0 +1,4 @@ +package com.bumble.livemosaic.participant + +actual fun prepareTimeZones() { +} diff --git a/shared/src/commonMain/kotlin/com/bumble/livemosaic/participant/Clock.kt b/shared/src/commonMain/kotlin/com/bumble/livemosaic/participant/Clock.kt index 20f3ea7f..fb933a54 100644 --- a/shared/src/commonMain/kotlin/com/bumble/livemosaic/participant/Clock.kt +++ b/shared/src/commonMain/kotlin/com/bumble/livemosaic/participant/Clock.kt @@ -52,6 +52,7 @@ data class Time(val hours: Int, val minutes: Int, val seconds: Int) @Composable fun ClockWidget(modifier: Modifier = Modifier) { + prepareTimeZones() fun currentTime(): Time { val cal = Clock.System.now() val dateTime: LocalDateTime = cal.toLocalDateTime(TimeZone.of("Europe/London")) diff --git a/shared/src/commonMain/kotlin/com/bumble/livemosaic/participant/PrepareTimeZones.kt b/shared/src/commonMain/kotlin/com/bumble/livemosaic/participant/PrepareTimeZones.kt new file mode 100644 index 00000000..fa65f465 --- /dev/null +++ b/shared/src/commonMain/kotlin/com/bumble/livemosaic/participant/PrepareTimeZones.kt @@ -0,0 +1,3 @@ +package com.bumble.livemosaic.participant + +expect fun prepareTimeZones() diff --git a/shared/src/desktopMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt b/shared/src/desktopMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt new file mode 100644 index 00000000..9cc06a67 --- /dev/null +++ b/shared/src/desktopMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt @@ -0,0 +1,4 @@ +package com.bumble.livemosaic.participant + +actual fun prepareTimeZones() { +} diff --git a/shared/src/jsMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt b/shared/src/jsMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt new file mode 100644 index 00000000..58e625e5 --- /dev/null +++ b/shared/src/jsMain/kotlin/com/bumble/livemosaic/participant/prepareTimeZones.kt @@ -0,0 +1,10 @@ +package com.bumble.livemosaic.participant + +@JsModule("@js-joda/timezone") +@JsNonModule +external object JsJodaTimeZoneModule + +private val jsJodaTz = JsJodaTimeZoneModule +actual fun prepareTimeZones() { + jsJodaTz +}