Files
Remever/lib/components/extensions/duration_extensions.dart
2025-03-03 20:59:42 +03:00

22 lines
623 B
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
///
/// Расширение для работы с [Duration]
///
extension AppDuration on Duration {
///
/// Получение длительности в формате mm:ss
///
String get mmss => hhmmss.substring('00:'.length);
///
/// Получение длительности в формате HH:mm:ss
///
String get hhmmss {
String twoDigits(int n) => n.toString().padLeft(2, '0');
String twoDigitMinutes = twoDigits(inMinutes.remainder(60));
String twoDigitSeconds = twoDigits(inSeconds.remainder(60));
return '${twoDigits(inHours)}:$twoDigitMinutes:$twoDigitSeconds';
}
}