From 284b3cc9f261f97c88c4cb7bfcf47b74ae3fc87f Mon Sep 17 00:00:00 2001 From: Send_Nukez Date: Fri, 12 Nov 2021 22:25:21 +0100 Subject: [PATCH] fix "invalid date" and show full date on hover --- CHANGELOG.md | 3 ++- src/js/main.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c98e0c6..aa25452 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,4 +11,5 @@ Fixed: Improved: - Settings that have been changed from default will now show a line next to them. Inspired by the [Visual Studio Code settings UI](https://d33wubrfki0l68.cloudfront.net/d1f1ea4def506997ced23d3d912154794e530e1c/063d2/assets/img/blog/2020-09-17-vscode-settings/settings-ui.png) - Checkbox / Switch input styles are now more in line with other input styles -- Available updates are now shown as a clickable button next to your user icon instead of having to open the user menu \ No newline at end of file +- Available updates are now shown as a clickable button next to your user icon instead of having to open the user menu +- Hovering over the release date in the album info now shows the full date \ No newline at end of file diff --git a/src/js/main.js b/src/js/main.js index 6efef93..8c5f80a 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -435,7 +435,7 @@ waitForElement(["#main"], () => { /* js */ async function getAlbumRelease(uri) { const info = await Spicetify.CosmosAsync.get(`hm://album/v1/album-app/album/${uri}/desktop`); - return { year: info.year, month: info.month ?? 1, day: info.day ?? 1 }; + return { year: info.year, month: (info.month ?? 1) - 1, day: info.day ?? 1 }; } function isLight(hex) { @@ -668,7 +668,7 @@ async function songchange() { `; - const albumDateElem = `${albumDate.format(moment().diff(albumDate, "months") <= 6 ? "MMM YYYY" : "YYYY")}`; + const albumDateElem = `${albumDate.format(moment().diff(albumDate, "months") <= 6 ? "MMM YYYY" : "YYYY")}`; albumInfoSpan.innerHTML = `${albumLinkElem}${albumDateElem}`; } else if (Spicetify.Player.data.track.uri.includes("spotify:episode")) { // podcast