Fix date compare and when to reset wallpaper
Some checks failed
Tests / tests (push) Has been cancelled

This commit is contained in:
Dustin Brett
2025-04-24 22:07:44 -07:00
parent edea113e87
commit 82a9573308

View File

@@ -271,14 +271,14 @@ const useWallpaper = (
cleanUpBufferUrl(currentWallpaperUrl); cleanUpBufferUrl(currentWallpaperUrl);
} }
resetWallpaper();
let wallpaperUrl = ""; let wallpaperUrl = "";
let fallbackBackground = ""; let fallbackBackground = "";
let newWallpaperFit = wallpaperFit; let newWallpaperFit = wallpaperFit;
const isSlideshow = wallpaperName === "SLIDESHOW"; const isSlideshow = wallpaperName === "SLIDESHOW";
if (isSlideshow) { if (isSlideshow) {
resetWallpaper();
const slideshowFilePath = `${PICTURES_FOLDER}/${SLIDESHOW_FILE}`; const slideshowFilePath = `${PICTURES_FOLDER}/${SLIDESHOW_FILE}`;
if (!(await exists(slideshowFilePath))) { if (!(await exists(slideshowFilePath))) {
@@ -335,13 +335,18 @@ const useWallpaper = (
// eslint-disable-next-line unicorn/no-unreadable-array-destructuring // eslint-disable-next-line unicorn/no-unreadable-array-destructuring
const [, , currentDate] = wallpaperImage.split(" "); const [, , currentDate] = wallpaperImage.split(" ");
const [month, , day, , year] = new Intl.DateTimeFormat(DEFAULT_LOCALE, { const [month, , day, , year] = new Intl.DateTimeFormat(DEFAULT_LOCALE, {
day: "2-digit",
month: "2-digit",
timeZone: "US/Eastern", timeZone: "US/Eastern",
year: "numeric",
}) })
.formatToParts(Date.now()) .formatToParts(Date.now())
.map(({ value }) => value); .map(({ value }) => value);
if (currentDate === `${year}-${month}-${day}`) return; if (currentDate === `${year}-${month}-${day}`) return;
resetWallpaper();
const { const {
date = "", date = "",
hdurl = "", hdurl = "",
@@ -373,6 +378,8 @@ const useWallpaper = (
} }
} }
} else if (await exists(wallpaperImage)) { } else if (await exists(wallpaperImage)) {
resetWallpaper();
let fileData = await readFile(wallpaperImage); let fileData = await readFile(wallpaperImage);
const imgExt = getExtension(wallpaperImage); const imgExt = getExtension(wallpaperImage);