aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Media
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-05-24 07:31:37 -0700
committerFuwn <[email protected]>2024-05-24 07:31:37 -0700
commit017364a6ac6146fe7213b6654532de7607597d43 (patch)
tree8c11ec591e5153b58a67bebfb18f2ed922e682ae /src/lib/Media
parentfix(badges): shadow hide refresh (diff)
downloaddue.moe-017364a6ac6146fe7213b6654532de7607597d43.tar.xz
due.moe-017364a6ac6146fe7213b6654532de7607597d43.zip
fix(match): delayed and subtitled time compatibility
Diffstat (limited to 'src/lib/Media')
-rw-r--r--src/lib/Media/Anime/Airing/Subtitled/match.ts18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/Media/Anime/Airing/Subtitled/match.ts b/src/lib/Media/Anime/Airing/Subtitled/match.ts
index d8534090..b5cdc7d7 100644
--- a/src/lib/Media/Anime/Airing/Subtitled/match.ts
+++ b/src/lib/Media/Anime/Airing/Subtitled/match.ts
@@ -142,6 +142,7 @@ export const injectAiringTime = (anime: Media, subsPlease: SubsPlease | null) =>
if (season() !== anime.season) return anime;
const airingAt = anime.nextAiringEpisode?.airingAt;
+ const now = new Date();
// const nativeUntilAiring = airingAt
// ? Math.round((airingAt - Date.now() / 1000) * 100) / 100
// : undefined;
@@ -180,13 +181,18 @@ export const injectAiringTime = (anime: Media, subsPlease: SubsPlease | null) =>
}
}
- if (
- airingAt &&
- nativeTime.getTime() !== time.getTime() &&
- nativeTime.getTime() - time.getTime() > 24 * 60 * 60 * 1000 &&
- nativeTime.getTime() - Date.now() < 7 * 24 * 60 * 60 * 1000
- )
+ if (now >= nativeTime && now < time) {
nextEpisode -= 1;
+ }
+
+ if (nativeTime.getTime() - now.getTime() > 7 * 24 * 60 * 60 * 1000) {
+ const beforeTime = time;
+
+ time = nativeTime;
+
+ time.setHours(beforeTime.getHours());
+ time.setMinutes(beforeTime.getMinutes());
+ }
return {
...anime,