diff --git a/app/src/main/java/fr/paug/androidmakers/ui/components/SessionDetailLayout.kt b/app/src/main/java/fr/paug/androidmakers/ui/components/SessionDetailLayout.kt index a8e293f6..b514b5da 100644 --- a/app/src/main/java/fr/paug/androidmakers/ui/components/SessionDetailLayout.kt +++ b/app/src/main/java/fr/paug/androidmakers/ui/components/SessionDetailLayout.kt @@ -302,7 +302,7 @@ private fun getFormattedDateAndRoom(room: Room, startTimestamp: Long, endTimesta startTimestamp, endTimestamp, DateUtils.FORMAT_SHOW_WEEKDAY or DateUtils.FORMAT_SHOW_TIME or DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_YEAR, - null).toString() + "Europe/Paris").toString() return if (room.name.isNotEmpty()) { stringResource(R.string.sessionDateWithRoomPlaceholder, sessionDate, room.name) } else { diff --git a/app/src/main/java/fr/paug/androidmakers/util/TimeUtils.kt b/app/src/main/java/fr/paug/androidmakers/util/TimeUtils.kt index 3bcc583b..b50e89b0 100644 --- a/app/src/main/java/fr/paug/androidmakers/util/TimeUtils.kt +++ b/app/src/main/java/fr/paug/androidmakers/util/TimeUtils.kt @@ -6,6 +6,7 @@ import androidx.compose.material.contentColorFor import fr.paug.androidmakers.R import java.time.Duration import java.time.OffsetDateTime +import java.time.ZoneId import java.util.* object TimeUtils { @@ -16,12 +17,18 @@ object TimeUtils { fun parseIso8601(iso8601: String): Date { return Date(OffsetDateTime.parse(iso8601).toEpochSecond() * 1000) } + + /** + * format the time as HH:mm in the timezone of the event + */ fun formatShortTime(context: Context?, time: Date?): String { + // Android DateFormatter will honor the user's current settings. val dateFormat = DateFormat.getTimeFormat(context) - // Override with Timezone based on settings since users can override their phone's timezone - // with Pacific time zones. - val tz = TimeZone.getDefault() + + // Display the time in the local time as everyone will be on site so it makes + // planning in advance easier + val tz = TimeZone.getTimeZone(ZoneId.of("Europe/Paris")) if (tz != null) { dateFormat.timeZone = tz }