chore: last episode by date

This commit is contained in:
Cory Dransfeldt 2024-08-08 18:04:06 -07:00
parent a856969fff
commit bf35b44f7a
No known key found for this signature in database
4 changed files with 9 additions and 5 deletions

View file

@ -259,5 +259,9 @@ export default {
return `${allButLast} and ${last}`
},
formatVenue: (venue) => venue.split(',')[0].trim(),
lastEpisode: (episodes) => `S${episodes[episodes.length - 1]['season_number']}E${episodes[episodes.length - 1]['episode_number']}`
lastWatchedEpisode: (episodes) => {
if (!episodes.length) return
const sortedEpisodes = episodes.sort((a, b) => new Date(a.last_watched_at) - new Date(b.last_watched_at))
return `S${sortedEpisodes[sortedEpisodes.length - 1]['season_number']}E${sortedEpisodes[sortedEpisodes.length - 1]['episode_number']}`
}
}