I try to set a date to midnight to simplify my date manipulation, for this I wrote this part of code:
var now = new Date();
today = now.setHours(0,0,0,0);
Is it normal?
How can I fix this?
You are assigning the return value of
Maybe what you are looking for is something like this:
var now = new Date(); var today = new Date(); today.setHours(0,0,0,0);
In this way,
setHours is acting upon the value you wish to have the hours set on. This is the primary manner of using
SET_LOCAL_DATE_VALUEfunction found chromium's date.js is assigning the value into the first argument.