mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-08-31 23:10:06 +02:00
18 lines
566 B
Dart
18 lines
566 B
Dart
extension DurationFormat on Duration {
|
|
/// formats the duration of the book as `10h 30m`
|
|
///
|
|
/// will add up all the durations of the audio files first
|
|
/// then convert them to the given format
|
|
String get formattedBinary {
|
|
final hours = inHours;
|
|
final minutes = inMinutes.remainder(60);
|
|
return '${hours}h ${minutes}m';
|
|
}
|
|
}
|
|
|
|
extension OnlyTime on DateTime {
|
|
// in format HH:MM:ss
|
|
// padding with 0
|
|
String get time =>
|
|
'${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}:${second.toString().padLeft(2, '0')}';
|
|
}
|