From 0bf7a8eadc6a0be16f922d2d94970d923530bd3e Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 19 Aug 2024 11:32:35 +0200 Subject: [PATCH] Moved also DateFormatter to fints4k project --- fints4k/build.gradle | 4 +++- .../dankito/banking/fints/mapper}/DateFormatter.kt | 2 +- .../banking/fints/transactions/mt940/Mt940Parser.kt | 2 +- .../dankito/banking/fints/mapper}/DateFormatter.kt | 11 ++++------- .../dankito/banking/fints/mapper}/DateFormatter.kt | 2 +- .../banking/fints/mapper}/JsJodaTimeZoneModule.kt | 2 +- .../dankito/banking/fints/mapper}/DateFormatter.kt | 3 +-- .../dankito/banking/fints/mapper}/DateFormatter.kt | 3 +-- 8 files changed, 13 insertions(+), 16 deletions(-) rename {multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform => fints4k/src/commonMain/kotlin/net/dankito/banking/fints/mapper}/DateFormatter.kt (83%) rename {multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform => fints4k/src/iosMain/kotlin/net/dankito/banking/fints/mapper}/DateFormatter.kt (60%) rename {multiplatform-utils/src/jsMain/kotlin/net/dankito/utils/multiplatform => fints4k/src/jsMain/kotlin/net/dankito/banking/fints/mapper}/DateFormatter.kt (84%) rename {multiplatform-utils/src/jsMain/kotlin/net/dankito/utils/multiplatform => fints4k/src/jsMain/kotlin/net/dankito/banking/fints/mapper}/JsJodaTimeZoneModule.kt (78%) rename {multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform => fints4k/src/jvmMain/kotlin/net/dankito/banking/fints/mapper}/DateFormatter.kt (90%) rename {multiplatform-utils/src/nativeMain/kotlin/net.dankito.utils.multiplatform => fints4k/src/nativeMain/kotlin/net/dankito/banking/fints/mapper}/DateFormatter.kt (85%) diff --git a/fints4k/build.gradle b/fints4k/build.gradle index bb1b34ec..308b0407 100644 --- a/fints4k/build.gradle +++ b/fints4k/build.gradle @@ -61,7 +61,7 @@ kotlin { sourceSets { commonMain { dependencies { - api project(":multiplatform-utils") + api("org.jetbrains.kotlinx:kotlinx-datetime:$kotlinxDateTimeVersion") implementation("net.codinux.log:kmp-log:1.5.1") @@ -108,6 +108,8 @@ kotlin { jsMain { dependencies { implementation("io.ktor:ktor-client-js:$ktorVersion") + + api(npm("@js-joda/timezone", "2.3.0")) } } diff --git a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt similarity index 83% rename from multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt rename to fints4k/src/commonMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt index f0580d7e..defa736b 100644 --- a/multiplatform-utils/src/commonMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt @@ -1,4 +1,4 @@ -package net.dankito.utils.multiplatform +package net.dankito.banking.fints.mapper import kotlinx.datetime.LocalDate diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt index 4fb6a008..b3a71dff 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/transactions/mt940/Mt940Parser.kt @@ -7,7 +7,7 @@ import net.dankito.banking.fints.extensions.todayAtEuropeBerlin import net.dankito.banking.fints.log.IMessageLogAppender import net.dankito.banking.fints.model.Amount import net.dankito.banking.fints.transactions.mt940.model.* -import net.dankito.utils.multiplatform.DateFormatter +import net.dankito.banking.fints.mapper.DateFormatter /* diff --git a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt b/fints4k/src/iosMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt similarity index 60% rename from multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt rename to fints4k/src/iosMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt index 53c990e0..cd106eb9 100644 --- a/multiplatform-utils/src/iosMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt +++ b/fints4k/src/iosMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt @@ -1,17 +1,14 @@ -package net.dankito.utils.multiplatform - -import kotlinx.datetime.* -import net.dankito.utils.multiplatform.extensions.toLocalDateTime -import platform.Foundation.* - +package net.dankito.banking.fints.mapper +import kotlinx.datetime.LocalDate +import kotlinx.datetime.TimeZone actual class DateFormatter actual constructor(val pattern: String): NSDateFormatter() { actual fun parseDate(dateString: String): LocalDate? { this.dateFromString(dateString)?.let { nsDate -> - return nsDate.toKotlinInstant().toLocalDateTime(TimeZone.currentSystemDefault())?.date + return nsDate.toKotlinInstant().toLocalDateTime(TimeZone.Companion.currentSystemDefault())?.date } return null diff --git a/multiplatform-utils/src/jsMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt b/fints4k/src/jsMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt similarity index 84% rename from multiplatform-utils/src/jsMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt rename to fints4k/src/jsMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt index 7736b7c1..d33b26da 100644 --- a/multiplatform-utils/src/jsMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt +++ b/fints4k/src/jsMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt @@ -1,4 +1,4 @@ -package net.dankito.utils.multiplatform +package net.dankito.banking.fints.mapper import kotlinx.datetime.LocalDate diff --git a/multiplatform-utils/src/jsMain/kotlin/net/dankito/utils/multiplatform/JsJodaTimeZoneModule.kt b/fints4k/src/jsMain/kotlin/net/dankito/banking/fints/mapper/JsJodaTimeZoneModule.kt similarity index 78% rename from multiplatform-utils/src/jsMain/kotlin/net/dankito/utils/multiplatform/JsJodaTimeZoneModule.kt rename to fints4k/src/jsMain/kotlin/net/dankito/banking/fints/mapper/JsJodaTimeZoneModule.kt index 651cd255..3241e16c 100644 --- a/multiplatform-utils/src/jsMain/kotlin/net/dankito/utils/multiplatform/JsJodaTimeZoneModule.kt +++ b/fints4k/src/jsMain/kotlin/net/dankito/banking/fints/mapper/JsJodaTimeZoneModule.kt @@ -1,4 +1,4 @@ -package net.dankito.utils.multiplatform +package net.dankito.banking.fints.mapper // required so that Joda time zones get loaded, see: // https://github.com/Kotlin/kotlinx-datetime#note-about-time-zones-in-js diff --git a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt b/fints4k/src/jvmMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt similarity index 90% rename from multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt rename to fints4k/src/jvmMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt index 389d96bd..ae66ec54 100644 --- a/multiplatform-utils/src/jvmMain/kotlin/net/dankito/utils/multiplatform/DateFormatter.kt +++ b/fints4k/src/jvmMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt @@ -1,10 +1,9 @@ -package net.dankito.utils.multiplatform +package net.dankito.banking.fints.mapper import kotlinx.datetime.LocalDate import kotlinx.datetime.toKotlinLocalDate import java.time.format.DateTimeFormatter - actual class DateFormatter actual constructor(pattern: String) { private val formatter = DateTimeFormatter.ofPattern(pattern) diff --git a/multiplatform-utils/src/nativeMain/kotlin/net.dankito.utils.multiplatform/DateFormatter.kt b/fints4k/src/nativeMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt similarity index 85% rename from multiplatform-utils/src/nativeMain/kotlin/net.dankito.utils.multiplatform/DateFormatter.kt rename to fints4k/src/nativeMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt index 7222f061..d0f9d883 100644 --- a/multiplatform-utils/src/nativeMain/kotlin/net.dankito.utils.multiplatform/DateFormatter.kt +++ b/fints4k/src/nativeMain/kotlin/net/dankito/banking/fints/mapper/DateFormatter.kt @@ -1,8 +1,7 @@ -package net.dankito.utils.multiplatform +package net.dankito.banking.fints.mapper import kotlinx.datetime.LocalDate - actual class DateFormatter actual constructor(pattern: String) { actual fun parseDate(dateString: String): LocalDate? {