jisotalo / shelly-porssisahko

Nordpool-pörssisähköohjaus Shelly-releisiin - Nordpool price control for Shelly relays
https://jisotalo.fi/shelly-porssisahko
GNU Affero General Public License v3.0
40 stars 13 forks source link

The Elering query will not work in December #9

Closed LeivoSepp closed 1 year ago

LeivoSepp commented 1 year ago

https://github.com/jisotalo/shelly-porssisahko/blob/6675f1e020f5ac600561d55db1360f34e99f2668/src/shelly-porssisahko.js#L382 In December this formula gives a month 13. getMonth() + 1

1 Solution is to use something like this: month > 12 ? 1 : month

2 Solution is even better: new Date().toISOString().slice(0,10) + tadatada

jisotalo commented 1 year ago

Hello

I don't understand how it could give a month 13?

getMonth() returns month index, so today it returns 10 and in december 11. So +1 is 12.

LeivoSepp commented 1 year ago

Ahh, you are right. I think it was very late and my mathematics was upside down :)

jisotalo commented 1 year ago

Thanks for confirming!

I know the feeling 😄