JavaScript:
- var now = new Date();
- var monday = now;
- monday.setDate(now.getDate() - now.getDay() + 1);
- monday_date = monday.getFullYear() + "-" + monday.getMonth() + "-" + monday.getDate();
- now = new Date();
- var sunday = new Date();
- sunday.setDate(now.getDate() - now.getDay() + 7);
- monday_date = sunday.getFullYear() + "-" + sunday.getMonth() + "-" + sunday.getDate();
Rails:
- monday_date = Date.today.beginning_of_week.strftime('%d/%m/%Y')