diff options
author | Luna <me@lunya.dev> | 2024-09-04 11:19:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 11:19:12 +0200 |
commit | 461fa9c4ece3a85b9cac7f7247fcc0c71a4a31e3 (patch) | |
tree | 20b554b12eda8310a3e181ea6ade1cb57d290a92 /src/main/java/at/hannibal2/skyhanni/utils | |
parent | c13744021e4ba9ddcba42a5635bde8a5d2617292 (diff) | |
download | skyhanni-461fa9c4ece3a85b9cac7f7247fcc0c71a4a31e3.tar.gz skyhanni-461fa9c4ece3a85b9cac7f7247fcc0c71a4a31e3.tar.bz2 skyhanni-461fa9c4ece3a85b9cac7f7247fcc0c71a4a31e3.zip |
Improvement: Allow turning off exact minutes on custom scoreboard (#2443)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt index 201c294e5..b31bb828b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt @@ -105,12 +105,15 @@ object TimeUtils { yearElement: Boolean = true, hoursAndMinutesElement: Boolean = true, timeFormat24h: Boolean = false, + exactMinutes: Boolean = true, ): String { val hour = if (timeFormat24h) this.hour else (this.hour + 11) % 12 + 1 val timeOfDay = if (!timeFormat24h) { if (this.hour > 11) "pm" else "am" } else "" - val minute = this.minute.toString().padStart(2, '0') + val minute = this.minute.let { + if (exactMinutes) it else it - (it % 10) + }.toString().padStart(2, '0') val month = SkyBlockTime.monthName(this.month) val day = this.day val daySuffix = SkyBlockTime.daySuffix(day) |