Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ planned for 2026-01-01
- fixed eslint warnings shown in #3911 and updated npm publish docs (#3913)
- [core] refactor: replace `express-ipfilter` with lightweight custom middleware (#3917) - This fixes security issue [CVE-2023-42282](https://github.com/advisories/GHSA-78xj-cgh5-2h22), which is not very likely to be exploitable in MagicMirror² setups, but still should be fixed.
- fixed the Environment Canada weather URL (#3912) and now converts a windspeed of 'calm' to 0
- fixed problems with daylight-saving-time in weather provider `openmeto` (#3930, #3931)

### Updated

Expand Down
13 changes: 12 additions & 1 deletion modules/default/weather/providers/openmeteo.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,24 @@ WeatherProvider.register("openmeteo", {
return `${this.config.apiBase}/forecast?${this.getQueryParameters()}`;
},

// fix daylight-saving-time differences
checkDST (dt) {
const uxdt = moment.unix(dt);
const nowDST = moment().isDST();
if (nowDST === moment(uxdt).isDST()) {
return uxdt;
} else {
return uxdt.add(nowDST ? +1 : -1, "hour");
}
},

// Transpose hourly and daily data matrices
transposeDataMatrix (data) {
return data.time.map((_, index) => Object.keys(data).reduce((row, key) => {
return {
...row,
// Parse time values as momentjs instances
[key]: ["time", "sunrise", "sunset"].includes(key) ? moment.unix(data[key][index]) : data[key][index]
[key]: ["time", "sunrise", "sunset"].includes(key) ? this.checkDST(data[key][index]) : data[key][index]
};
}, {}));
},
Expand Down