Moved also DateFormatter to fints4k project

This commit is contained in:
dankito 2024-08-19 11:32:35 +02:00
parent 6a7f8d6780
commit 0bf7a8eadc
8 changed files with 13 additions and 16 deletions

View File

@ -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"))
}
}

View File

@ -1,4 +1,4 @@
package net.dankito.utils.multiplatform
package net.dankito.banking.fints.mapper
import kotlinx.datetime.LocalDate

View File

@ -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
/*

View File

@ -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

View File

@ -1,4 +1,4 @@
package net.dankito.utils.multiplatform
package net.dankito.banking.fints.mapper
import kotlinx.datetime.LocalDate

View File

@ -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

View File

@ -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)

View File

@ -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? {