I would like for the previous Monday to appear in the field where a user enters today\'s date.
E.g.: If today\'s date is entered 29-Jan-16 t
29-Jan-16
var prevMonday = new Date(); prevMonday.setDate(prevMonday.getDate() - (prevMonday.getDay() + 6) % 7);
I am a little late but I like this solution. It's a one liner and not that complicated. Making a function for that seems overkill to me.