Open AndroidDeveloperLB opened 6 years ago
Seems it's a part of the sample itself, in BaseActivity. Here's how it should be there:
private fun setupDateTimeInterpreter(shortDate: Boolean) {
val calendar = Calendar.getInstance()
calendar.set(Calendar.MINUTE, 0)
calendar.set(Calendar.SECOND, 0)
calendar.set(Calendar.MILLISECOND, 0)
val dateFormat = DateFormat.getTimeFormat(this@BaseActivity)
?: SimpleDateFormat("HH:mm", Locale.getDefault())
weekView.dateTimeInterpreter = object : DateTimeInterpreter {
...
override fun interpretTime(hour: Int): String {
calendar.set(Calendar.HOUR_OF_DAY, hour)
return dateFormat.format(calendar.time)
}
}
}
Fixed it here: https://github.com/alamkanak/Android-Week-View/pull/496
Events get formatted fine, but not side hours:
Also, I've noticed that the library uses some constant ways to show the time formatting, by checking if the system uses 24 hours or not. That's not the best way to do it.
The correct way to do it is by getting the OS format alone :