I stumbled upon a seemingly respected source of a weird date manipulation that I don't understand. This is part of the documentation support documentation for the popular user interface:
var startDate = start.value();
Now line by line var startDate = start.value(); these lines return a Date object and store it in the startDate variable. Great, no problem here.
Then we create a new Date object with the same value and assign it to the same variable (slightly confusing, but I can live with it).
The third line is a real puzzle - we get the day of the month (via getDate ) and assign it as the day of the month (via setDate ) in the same variable.
Now the question is: is this bad code, perhaps the remnants from incomplete refactoring? Or does it really make sense, and he does some manipulation, like time removal (not like this)? If so, what is he doing?
UPD : sample code here http://demos.telerik.com/kendo-ui/datepicker/rangeselection
javascript date
trailmax
source share