mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-15 01:35:25 +00:00
Implemented side tree to devices and rountines screen
This commit is contained in:
15
lib/pages/routines/helper/duration_format_helper.dart
Normal file
15
lib/pages/routines/helper/duration_format_helper.dart
Normal file
@ -0,0 +1,15 @@
|
||||
class DurationFormatMixin {
|
||||
static String formatDuration(int seconds) {
|
||||
if (seconds >= 3600) {
|
||||
final hours = (seconds / 3600).floor();
|
||||
final remainingMinutes = ((seconds % 3600) / 60).floor();
|
||||
final remainingSeconds = seconds % 60;
|
||||
return '$hours h ${remainingMinutes}m ${remainingSeconds}s';
|
||||
} else if (seconds >= 60) {
|
||||
final minutes = (seconds / 60).floor();
|
||||
final remainingSeconds = seconds % 60;
|
||||
return '$minutes m ${remainingSeconds}s';
|
||||
}
|
||||
return '${seconds}s';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user