Files
lunasea/lib/core/extensions/duration.dart
Jagandeep Brar f7807ed762 [Release] v4.2.0+40200001 (#287)
NEW
- [Settings/Modules] Add an information/help button with module descriptions and links

TWEAKS
- [Radarr] Always show the amount of days content will be available instead of limiting it to only content in the next 30 days
- [Settings] Moved "Backup & Restore" and "Logs" to "System" section
- [Settings] Merged "Customization" and "Modules" sections into "Configuration"
- [Settings/Sonarr] Removed the need to enable Sonarr to test the connection
- [Settings/Tautulli] Removed the need to enable Tautulli to test the connection

FIXES
- [IAPs] Ensure all IAPs are marked as "consumed"
- [Flutter] Updated packages
- [Logging] Updated Sentry to v4 framework to improve capturing fatal/crashing bugs
- [Settings/Logs] Hide exception and stack trace buttons when an error is not available
- [Sonarr/History] Fixed history fetching the oldest entries, not the newest
- [State] Correctly clear state when clearing LunaSea's configuration
- [Tautulli/Activity] Fixed consistency of hardware transcoding indicator compared to the web UI
- [UI/Divider] Fix consistency of divider width across regular and AMOLED dark theme
2020-12-22 08:46:25 -06:00

32 lines
1.2 KiB
Dart

import 'package:lunasea/core.dart';
extension DurationExtension on Duration {
/// Return a string representation of the timestamp.
///
/// Format example: HH:MM:SS or MM:SS if the duration is less than one hour
String get lunaTimestamp => [
if(this.inHours != 0) this.inHours.toString().padLeft(2, '0'),
(this.inMinutes%60).toString().padLeft(2, '0'),
(this.inSeconds%60).toString().padLeft(2, '0'),
].join(':');
/// Returns a string representation of the timestamp as words.
///
/// Format example: 1 Day, 23 Hours, 10 Minutes
String get lunaTimestampWords {
String days, hours, minutes;
if(this.inDays == 1) days = '1 Day';
if(this.inDays > 1) days = '${this.inDays.toString()} Days';
if(this.inHours == 1) hours = '1 Hour';
if(this.inHours > 1) hours = '${(this.inHours%24).toString()} Hours';
if(this.inMinutes == 1) minutes = '1 Minute';
if(this.inMinutes > 1) minutes = '${(this.inMinutes%60).toString()} Minutes';
return [
if(days != null) days,
if(hours != null) hours,
if(minutes != null) minutes,
if(minutes == null) Constants.TEXT_EMDASH,
].join(' ');
}
}