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