diff --git a/server/scripts/modules/almanac.mjs b/server/scripts/modules/almanac.mjs index 3eee356..93e1665 100644 --- a/server/scripts/modules/almanac.mjs +++ b/server/scripts/modules/almanac.mjs @@ -47,10 +47,7 @@ class Almanac extends WeatherDisplay { } calcSunMoonData(weatherParameters) { - const sun = [ - SunCalc.getTimes(new Date(), weatherParameters.latitude, weatherParameters.longitude), - SunCalc.getTimes(DateTime.local().plus({ days: 1 }).toJSDate(), weatherParameters.latitude, weatherParameters.longitude), - ]; + const sun = [0, 1, 2, 3, 4, 5, 6].map((days) => SunCalc.getTimes(DateTime.local().plus({ days }).toJSDate(), weatherParameters.latitude, weatherParameters.longitude)); // brute force the moon phases by scanning the next 30 days const moon = []; diff --git a/server/scripts/modules/extendedforecast.mjs b/server/scripts/modules/extendedforecast.mjs index d5989fd..b78cf71 100644 --- a/server/scripts/modules/extendedforecast.mjs +++ b/server/scripts/modules/extendedforecast.mjs @@ -17,7 +17,13 @@ class ExtendedForecast extends WeatherDisplay { super(navId, elemId, 'Extended Forecast', true); // set timings - this.timing.totalScreens = 2; + if (settings.enhancedScreens?.value) { + this.timing.totalScreens = 1; + this.perPage = 4; + } else { + this.timing.totalScreens = 2; + this.perPage = 3; + } } async getData(weatherParameters, refresh) { @@ -54,7 +60,7 @@ class ExtendedForecast extends WeatherDisplay { // determine bounds // grab the first three or second set of three array elements - const forecast = parse(this.data.properties.periods, this.weatherParameters.forecast).slice(0 + 3 * this.screenIndex, 3 + this.screenIndex * 3); + const forecast = parse(this.data.properties.periods, this.weatherParameters.forecast).slice(0 + this.perPage * this.screenIndex, this.perPage + this.screenIndex * this.perPage); // create each day template const days = forecast.map((Day) => {