chore: remove unused formatRelativeTime
This commit is contained in:
@@ -185,43 +185,6 @@ String formatFinishTime(Duration remaining, {double rate = 1.0}) {
|
||||
return formatter.format(finishTime);
|
||||
}
|
||||
|
||||
/// Formats a DateTime as a relative time string (e.g., "just now", "5m", "3h", "2d", or a full date).
|
||||
/// Uses the `duration` package for localized unit names.
|
||||
///
|
||||
/// Used for: recent connections timestamps.
|
||||
String formatRelativeTime(DateTime date) {
|
||||
final now = DateTime.now();
|
||||
final difference = now.difference(date);
|
||||
|
||||
if (difference.inMinutes < 1) {
|
||||
return prettyDuration(
|
||||
Duration.zero,
|
||||
abbreviated: true,
|
||||
locale: _getDurationLocale(),
|
||||
tersity: DurationTersity.minute,
|
||||
upperTersity: DurationTersity.minute,
|
||||
);
|
||||
} else if (difference.inDays < 7) {
|
||||
return prettyDuration(
|
||||
difference,
|
||||
abbreviated: true,
|
||||
locale: _getDurationLocale(),
|
||||
delimiter: ' ',
|
||||
spacer: '',
|
||||
tersity: DurationTersity.minute,
|
||||
upperTersity: () {
|
||||
if (difference.inDays >= 1) return DurationTersity.day;
|
||||
if (difference.inHours >= 1) return DurationTersity.hour;
|
||||
return DurationTersity.minute;
|
||||
}(),
|
||||
maxUnits: 1,
|
||||
);
|
||||
} else {
|
||||
final formatter = DateFormat.yMd(LocaleSettings.currentLocale.languageCode);
|
||||
return formatter.format(date);
|
||||
}
|
||||
}
|
||||
|
||||
/// Takes a list of strings and returns one long string with each item in the list concatenated by a bullet
|
||||
String toBulletedString(List<String> parts) {
|
||||
return parts.join(' · ');
|
||||
|
||||
Reference in New Issue
Block a user