✨ Enrich user profile settings
This commit is contained in:
18
lib/services/time.dart
Normal file
18
lib/services/time.dart
Normal file
@ -0,0 +1,18 @@
|
||||
extension DurationFormatter on Duration {
|
||||
String formatDuration() {
|
||||
final isNegative = inMicroseconds < 0;
|
||||
final positiveDuration = isNegative ? -this : this;
|
||||
|
||||
final hours = positiveDuration.inHours.toString().padLeft(2, '0');
|
||||
final minutes = (positiveDuration.inMinutes % 60).toString().padLeft(
|
||||
2,
|
||||
'0',
|
||||
);
|
||||
final seconds = (positiveDuration.inSeconds % 60).toString().padLeft(
|
||||
2,
|
||||
'0',
|
||||
);
|
||||
|
||||
return '${isNegative ? '-' : ''}$hours:$minutes:$seconds';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user