mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
Make sure smhi provider api only gets a maximimum of 6 digits coordinates (#2956)
Fixes #2955 Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
parent
2d3940a4ff
commit
dde88601a6
@ -27,6 +27,7 @@ Special thanks to: @rejas, @sdetweil
|
|||||||
- Updated e2e tests (moved `done()` in helper functions) and use es6 syntax in all tests
|
- Updated e2e tests (moved `done()` in helper functions) and use es6 syntax in all tests
|
||||||
- Updated da translation
|
- Updated da translation
|
||||||
- Rework weather module
|
- Rework weather module
|
||||||
|
- Make sure smhi provider api only gets a maximum of 6 digits coordinates (#2955)
|
||||||
- Use fetch instead of XMLHttpRequest in weatherprovider
|
- Use fetch instead of XMLHttpRequest in weatherprovider
|
||||||
- Reworked how weatherproviders handle units
|
- Reworked how weatherproviders handle units
|
||||||
- Use unix() method for parsing times, fix suntimes on the way
|
- Use unix() method for parsing times, fix suntimes on the way
|
||||||
|
@ -15,8 +15,8 @@ WeatherProvider.register("smhi", {
|
|||||||
|
|
||||||
// Set the default config properties that is specific to this provider
|
// Set the default config properties that is specific to this provider
|
||||||
defaults: {
|
defaults: {
|
||||||
lat: 0,
|
lat: 0, // Cant have more than 6 digits
|
||||||
lon: 0,
|
lon: 0, // Cant have more than 6 digits
|
||||||
precipitationValue: "pmedian",
|
precipitationValue: "pmedian",
|
||||||
location: false
|
location: false
|
||||||
},
|
},
|
||||||
@ -104,8 +104,12 @@ WeatherProvider.register("smhi", {
|
|||||||
* @returns {string} the url for the specified coordinates
|
* @returns {string} the url for the specified coordinates
|
||||||
*/
|
*/
|
||||||
getURL() {
|
getURL() {
|
||||||
let lon = this.config.lon;
|
const formatter = new Intl.NumberFormat("en-US", {
|
||||||
let lat = this.config.lat;
|
minimumFractionDigits: 6,
|
||||||
|
maximumFractionDigits: 6
|
||||||
|
});
|
||||||
|
const lon = formatter.format(this.config.lon);
|
||||||
|
const lat = formatter.format(this.config.lat);
|
||||||
return `https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/${lon}/lat/${lat}/data.json`;
|
return `https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/${lon}/lat/${lat}/data.json`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user