diff options
| author | Fuwn <[email protected]> | 2024-01-18 00:40:37 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-01-18 00:40:37 -0800 |
| commit | 86449bc67089f1225e254f421ec1e4171472e446 (patch) | |
| tree | 697aa038d348de5bdf2690aabf4097d4da11716d /src/lib | |
| parent | fix(manga): remove chapter check from completed (diff) | |
| download | due.moe-86449bc67089f1225e254f421ec1e4171472e446.tar.xz due.moe-86449bc67089f1225e254f421ec1e4171472e446.zip | |
feat(airing): shorten countdown setting
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/Media/Anime/Airing/time.ts | 14 | ||||
| -rw-r--r-- | src/lib/Settings/Categories/Display.svelte | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/lib/Media/Anime/Airing/time.ts b/src/lib/Media/Anime/Airing/time.ts index 4e65843d..6ddc9aff 100644 --- a/src/lib/Media/Anime/Airing/time.ts +++ b/src/lib/Media/Anime/Airing/time.ts @@ -21,6 +21,7 @@ export const airingTime = ( }); let timeFrame; let hours = null; + const shortenCountdown = get(settings).displayShortCountdown; if ( (anime as unknown as MediaPrequel).startDate && @@ -55,13 +56,20 @@ export const airingTime = ( // } else { const days = Math.round(Math.floor(hours / 24)); - timeFrame = `${days.toFixed(0)} day${days === 1 ? '' : 's'}`; + timeFrame = `${days.toFixed(0)}${shortenCountdown ? 'd' : ' day'}${ + days === 1 || shortenCountdown ? '' : 's' + }`; // } - } else timeFrame = `${hours.toFixed(1)} hour${hours === 1 ? '' : 's'}`; + } else + timeFrame = `${hours.toFixed(1)}${shortenCountdown ? 'h' : ' hour'}${ + hours === 1 || shortenCountdown ? '' : 's' + }`; } else { minutes = Math.round(minutes); - timeFrame = `${minutes} minute${minutes === 1 ? '' : 's'}`; + timeFrame = `${minutes}${shortenCountdown ? 'h' : ' minute'}${ + minutes === 1 || shortenCountdown ? '' : 's' + }`; } const opacity = Math.max(50, 100 - (untilAiring / 60 / 60 / 24 / 7) * 50); diff --git a/src/lib/Settings/Categories/Display.svelte b/src/lib/Settings/Categories/Display.svelte index 4b38bef1..69b26aec 100644 --- a/src/lib/Settings/Categories/Display.svelte +++ b/src/lib/Settings/Categories/Display.svelte @@ -88,6 +88,10 @@ setting="displayNativeCountdown" text="Use native release date for episode countdown" /> +<SettingCheckboxToggle + setting="displayShortCountdown" + text="Shorten countdown to first character of unit" +/> <p /> |