From ba46c26bf71f66fd4e2cdfea702f517811b9dcf0 Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 12 Jul 2020 12:47:10 +0200 Subject: [PATCH] Fixed extracting year, month and day --- .../jvmMain/kotlin/net/dankito/utils/multiplatform/Date.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Date.kt b/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Date.kt index 0db9b3ae..a6b0d4a6 100644 --- a/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Date.kt +++ b/common/src/jvmMain/kotlin/net/dankito/utils/multiplatform/Date.kt @@ -17,7 +17,7 @@ actual class Date actual constructor(millisSinceEpoch: Long) : java.util.Date(mi actual fun year(): Int { - return formatDate(DateFormat.YEAR_FIELD) + return super.getYear() + 1900 } actual fun month(): Month { @@ -25,11 +25,11 @@ actual class Date actual constructor(millisSinceEpoch: Long) : java.util.Date(mi } actual fun monthInt(): Int { - return formatDate(DateFormat.MONTH_FIELD) + return super.getMonth() + 1 } actual fun day(): Int { - return formatDate(DateFormat.DAY_OF_YEAR_FIELD) + return super.getDate() } private fun formatDate(dateFormatStyle: Int): Int {