-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Partial for #3252: new Date() -> Date.now() #3314
base: develop
Are you sure you want to change the base?
Partial for #3252: new Date() -> Date.now() #3314
Conversation
Also, would be nice if we had a way to enforce people not using |
The prefer-date-now rule of the unicorn ESLint plugin seems to be a good solution for that. |
but teaching others the right way is a long haul problem. everybody has to quit breaking old code. |
oh that's cool, this would be ideal. I'm not sure how to hook it up though. |
@@ -95,7 +95,7 @@ WeatherProvider.register("weatherbit", { | |||
// Implement WeatherDay generator. | |||
generateWeatherDayFromCurrentWeather (currentWeatherData) { | |||
//Calculate TZ Offset and invert to convert Sunrise/Sunset times to Local | |||
const d = new Date(); | |||
const d = Date.now(); | |||
let tzOffset = d.getTimezoneOffset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Date.now() returns the number of milliseconds since January 1, 1970.
methods like getTimezoneOffset
will not work with your change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or those in calendarUtils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Fixed up in latest push
b5cc408
to
dd25c16
Compare
dd25c16
to
07f0dc5
Compare
@KristjanESPERANTO @sdetweil I could use some help with this. In calendar.js, this works:
But when I change this part:
then some of the electron tests like |
I'm not sure if the current construction is o.k. but I can explain what happens. If you change the one line then The mocking happens in The tests time out because the expected css property never appears. |
I don't have a better suggestion yet, but somehow |
[x] Updated Changelog
[x] Partial fix for #3252 (documentation is in a separate repo)
Btw, this probably shouldn't be in the PR template as 100+ unrelated files changed:
I can remove it from the template .md if you want. Or do a separate PR with all the style issues fixed :P