diff --git a/config/filters/index.js b/config/filters/index.js index 7116f060..d4ef5507 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -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']}` + } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index de40d6b3..dbd1f289 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "21.6.5", + "version": "21.6.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "21.6.5", + "version": "21.6.6", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.4.0", diff --git a/package.json b/package.json index 7b2d60e2..b95e9988 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "21.6.5", + "version": "21.6.6", "description": "The source for my personal site. Built using 11ty (and other tools).", "type": "module", "scripts": { diff --git a/src/pages/dynamic/watching/show.html b/src/pages/dynamic/watching/show.html index 90353ff8..bb58b1e9 100644 --- a/src/pages/dynamic/watching/show.html +++ b/src/pages/dynamic/watching/show.html @@ -37,7 +37,7 @@ schema: show {%- if lastWatched -%} {%- capture lastWatchedText -%} {%- if show.episodes -%} - I last watched {{ show.episodes | lastEpisode }} on {{ lastWatched | date: "%B %e, %Y" }}. + I last watched {{ show.episodes | lastWatchedEpisode }} on {{ lastWatched | date: "%B %e, %Y" }}. {%- else -%} Last watched on {{ lastWatched | date: "%B %e, %Y" }}. {%- endif -%}