Partial for #3252: new Date() -> Date.now()#3314
Partial for #3252: new Date() -> Date.now()#3314jkriegshauser wants to merge 3 commits intoMagicMirrorOrg:developfrom
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) |
|
This PR can be closed I think since calendar is migrated to moment |
As far as I understand it, this PR was intended to create the possibility to manipulate the date for the complete MagicMirror instance (not only for the calendar) for testing purposes. Is this possible now? Do we need this possibility? |
[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