Skip to content

Commit 96d3e87

Browse files
[weather] feat: add configurable forecast date format option (#3918)
I was a little disappointed that I couldn't change the date format in the forecast because it was hard-coded. This PR introduces a new option (`forecastDateFormat`) that allows the user to specify the format themselves. The default remains `ddd`. ## Before <img width="483" height="524" alt="Screenshot From 2025-10-18 18-26-13" src="https://github.com/user-attachments/assets/2de6af55-e73c-42e8-a3fe-7386ef5f90e0" /> ## After (examples) ### `forecastDateFormat: "dddd"` <img width="483" height="524" alt="Screenshot From 2025-10-18 18-26-27" src="https://github.com/user-attachments/assets/cd86c798-f1e4-4d75-adf9-c4e549aa2a51" /> ### `forecastDateFormat: "ddd, D MMM"` <img width="483" height="524" alt="Screenshot From 2025-10-18 18-28-02" src="https://github.com/user-attachments/assets/79aaa7b3-810a-4ab1-833c-09dfab7f457a" />
1 parent 37d1a3a commit 96d3e87

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ planned for 2026-01-01
1313

1414
### Added
1515

16+
- [weather] feat: add configurable forecast date format option (#3918)
17+
1618
### Changed
1719

1820
- [core] refactor: replace `module-alias` dependency with internal alias resolver (#3893)

modules/default/weather/forecast.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{% elif (currentStep == 1) and config.ignoreToday == false and config.absoluteDates == false %}
1717
<td class="day">{{ "TOMORROW" | translate }}</td>
1818
{% else %}
19-
<td class="day">{{ f.date.format("ddd") }}</td>
19+
<td class="day">{{ f.date.format(config.forecastDateFormat) }}</td>
2020
{% endif %}
2121
<td class="bright weather-icon">
2222
<span class="wi weathericon wi-{{ f.weatherType }}"></span>

modules/default/weather/weather.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Module.register("weather", {
4141
onlyTemp: false,
4242
colored: false,
4343
absoluteDates: false,
44+
forecastDateFormat: "ddd", // format for forecast date display, e.g., "ddd" = Mon, "dddd" = Monday, "D MMM" = 18 Oct
4445
hourlyForecastIncrements: 1
4546
},
4647

0 commit comments

Comments
 (0)