Add check for <= 0 time duration for Never case.

This commit is contained in:
Alex Hart
2025-06-26 14:26:18 -03:00
parent c75cafd5f5
commit bc10cd0d03

View File

@@ -446,14 +446,20 @@ private fun ActiveBackupsRow(
} }
} }
val lastBackupString = if (lastBackupAt.inWholeMilliseconds > 0) {
DateUtils.getDatelessRelativeTimeSpanFormattedDate(
LocalContext.current,
Locale.getDefault(),
lastBackupAt.inWholeMilliseconds
).value
} else {
stringResource(R.string.RemoteBackupsSettingsFragment__never)
}
Text( Text(
text = stringResource( text = stringResource(
R.string.BackupsSettingsFragment_last_backup_s, R.string.BackupsSettingsFragment_last_backup_s,
DateUtils.getDatelessRelativeTimeSpanFormattedDate( lastBackupString
LocalContext.current,
Locale.getDefault(),
lastBackupAt.inWholeMilliseconds
).value
), ),
color = MaterialTheme.colorScheme.onSurfaceVariant, color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyMedium style = MaterialTheme.typography.bodyMedium