I'm assuming you want a relative date parsing and the maximum should be yesterday. Thus your diff is being computed on which day of the week, which has to be between 1 and 7. Var olddate = new date (), momentobj =.
Using moment.js i can't transform a correct moment object to a date object with timezones. Moment (end.diff (starttime)).format (m [m] s [s]) however, i also want to display the hour when applicable. I know this has already been answered, but i stumbled across this question and went down the path of using format, which works, but it returns them as strings when i wanted.
I'm able to get the difference between two dates using momentjs as follows: I never used moment.js but as far as the docs say, it's pretty simple. Format('e') stands for day of week. You probably don't need moment.js anymore moment is great time manipulation library but it's considered as a legacy project, and the team is recommending to use other.
I can't get the correct date. Change the language of moment.js by using the locale method to set or get the desired language.