I'm trying to use moment to get the start of a day. I get different results with the following:
moment().startOf('day'); //good
moment(new Date()).startOf('day'); //this does not work!
fiddle: https://jsfiddle.net/y1of77wx/
The practical case is that I'm doing this in a function that takes in a date object as an argument:
function doWork(dt) {
return moment(dt).startOf('day');
}
I'm sure the solution is simple but I'm just missing something.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…