mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
29 lines
866 B
Dart
29 lines
866 B
Dart
import 'package:duration/locale.dart';
|
|
import 'package:spotube/utils/primitive_utils.dart';
|
|
import 'package:duration/duration.dart';
|
|
|
|
extension DurationToHumanReadableString on Duration {
|
|
String toHumanReadableString() =>
|
|
"${inMinutes.remainder(60)}:${PrimitiveUtils.zeroPadNumStr(inSeconds.remainder(60))}";
|
|
|
|
String format({
|
|
DurationTersity tersity = DurationTersity.second,
|
|
DurationTersity upperTersity = DurationTersity.week,
|
|
DurationLocale locale = const EnglishDurationLocale(),
|
|
String? spacer,
|
|
String? delimiter,
|
|
String? conjugation,
|
|
bool abbreviated = false,
|
|
}) =>
|
|
printDuration(
|
|
this,
|
|
tersity: tersity,
|
|
upperTersity: upperTersity,
|
|
locale: locale,
|
|
spacer: spacer,
|
|
delimiter: delimiter,
|
|
conjugation: conjugation,
|
|
abbreviated: abbreviated,
|
|
);
|
|
}
|