-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Partial for #3252: new Date() -> Date.now() #3314
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
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. |
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 |
Sorry, didn't see this.. yes the Date.now() breaks the override we do it tests.. const now = new Date(Date.now()); // breaks tests
const today = moment(Date.now()).startOf("day");
const future = moment(Date.now()).startOf("day").add(this.config.maximumNumberOfDays, "days").toDate(); should have been (as now has the Date object for logical now, actual or test mocked)
|
[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