Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Elering query will not work in December #9

Closed
LeivoSepp opened this issue Nov 2, 2023 · 3 comments
Closed

The Elering query will not work in December #9

LeivoSepp opened this issue Nov 2, 2023 · 3 comments

Comments

@LeivoSepp
Copy link

LeivoSepp commented Nov 2, 2023

+ padStart(now.getMonth() + 1, 2, "0")

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
Copy link
Owner

jisotalo commented Nov 4, 2023

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
Copy link
Author

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

@jisotalo
Copy link
Owner

jisotalo commented Nov 4, 2023

Thanks for confirming!

I know the feeling 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants