From c3e3ef10c71400cf305ec8585320706177143f15 Mon Sep 17 00:00:00 2001 From: DavidAparicioAlbaAsenjo <137989685+DavidAparicioAlbaAsenjo@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:53:05 +0200 Subject: [PATCH] ANDROAPP-6002-Modify-Date-storing-for-TimeZone-and-Daylight-Saving-Time-offset (#233) * update: [ANDROAPP-6002] Timezone formated properly * update: [ANDROAPP-6002] Code formatted --- .../mobile/ui/designsystem/component/InputDateTime.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputDateTime.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputDateTime.kt index 0690e156c..eb062b308 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputDateTime.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputDateTime.kt @@ -513,7 +513,13 @@ internal fun getDate(milliSeconds: Long?, format: String? = "ddMMyyyy"): String return if (milliSeconds != null) { cal.timeInMillis = milliSeconds val formater = SimpleDateFormat(format) - formater.format(cal.time) + if (gmtOffset < 0) { + var day = formater.format(cal.time).substring(0, 2).toInt() + day += 1 + formater.format(cal.time).replaceRange(0, 2, String.format("%02d", day)) + } else { + formater.format(cal.time) + } } else { "" }