diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-22 23:57:09 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-22 23:57:09 +1000 |
| commit | 1dad7d52ea19ef15f716a00d7845045dbbe2fc49 (patch) | |
| tree | 2b0ddebe328702b2389954eaa780a7ddcf1ed511 /services | |
| parent | config: add toasts for events (diff) | |
| download | caelestia-shell-1dad7d52ea19ef15f716a00d7845045dbbe2fc49.tar.gz caelestia-shell-1dad7d52ea19ef15f716a00d7845045dbbe2fc49.tar.bz2 caelestia-shell-1dad7d52ea19ef15f716a00d7845045dbbe2fc49.zip | |
notifs: wrap time to days
Diffstat (limited to 'services')
| -rw-r--r-- | services/Notifs.qml | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/services/Notifs.qml b/services/Notifs.qml index 3a81c5f..4dbabf4 100644 --- a/services/Notifs.qml +++ b/services/Notifs.qml @@ -139,13 +139,18 @@ Singleton { readonly property string timeStr: { const diff = Time.date.getTime() - time.getTime(); const m = Math.floor(diff / 60000); + + if (m < 1) + return qsTr("now"); + const h = Math.floor(m / 60); + const d = Math.floor(h / 24); - if (h < 1 && m < 1) - return "now"; - if (h < 1) - return `${m}m`; - return `${h}h`; + if (d > 0) + return `${d}d`; + if (h > 0) + return `${h}h`; + return `${m}m`; } property Notification notification |