Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ class DateFormatter(private val context: Context) {

// less than 1h
span < ONE_HOUR_IN_MILLIS -> {
val minutes: Int = span.toInt() / ONE_MINUTE_IN_MILLIS
context.resources
.getQuantityString(
R.plurals.date_formatting_relative_minutes,
span.toInt() / ONE_MINUTE_IN_MILLIS
minutes,
minutes
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DateFormatterTest {
val calendar = Calendar.getInstance()
calendar.add(Calendar.MINUTE, -5)
val formattedDate = dateFormatter.getConditionallyRelativeFormattedTimeSpan(calendar)
val expected = context.resources.getQuantityString(R.plurals.date_formatting_relative_minutes, 5)
val expected = "5m"
assertEquals(expected, formattedDate)
}

Expand All @@ -62,7 +62,7 @@ class DateFormatterTest {
val calendar = Calendar.getInstance()
calendar.add(Calendar.HOUR, -3)
val formattedDate = dateFormatter.getConditionallyRelativeFormattedTimeSpan(calendar)
val expected = context.resources.getQuantityString(R.plurals.date_formatting_relative_hours, 3, 3)
val expected = "3h"
assertEquals(expected, formattedDate)
}

Expand Down
Loading