Fixed conference scheduler date picker showing wrong date for UTC-X timezones

This commit is contained in:
Sylvain Berfini 2022-11-15 16:52:46 +01:00
parent 66edc747be
commit 8b86f91c1f

View file

@ -64,7 +64,11 @@ class TimestampUtils {
val calendar = Calendar.getInstance() val calendar = Calendar.getInstance()
calendar.timeInMillis = if (timestampInSecs) date * 1000 else date calendar.timeInMillis = if (timestampInSecs) date * 1000 else date
return SimpleDateFormat(pattern, Locale.getDefault()).format(calendar.time)
// See https://github.com/material-components/material-components-android/issues/882
val dateFormatter = SimpleDateFormat(pattern, Locale.getDefault())
dateFormatter.timeZone = TimeZone.getTimeZone("UTC")
return dateFormatter.format(calendar.time)
} }
fun timeToString(hour: Int, minutes: Int): String { fun timeToString(hour: Int, minutes: Int): String {