Винаги имам проблеми с намирането на функции за дати
var d = new Date(),
month = d.getMonth(),
mondays = [];
d.setDate(1);
// Get the first Monday in the month
while (d.getDay() !== 1) {
d.setDate(d.getDate() + 1);
}
// Get all the other Mondays in the month
while (d.getMonth() === month) {
var pushDate = new Date(d.getTime());
mondays.push(pushDate.getDate() + '-' + (pushDate.getMonth()+1) + '-' + pushDate.getFullYear());
d.setDate(d.getDate() + 7);
}
Използвам тази функция, за да получа всички понеделници в месеца, текущия месец.
Как мога да адаптирам този код, за да получа всички останали понеделници в годината?
if (d.getMonth() === 0) break;
- person Chris G   schedule 03.07.2017while (d.getMonth() === month) {
няма ли да трябва да го актуализирам? - person Toni Michel Caubet   schedule 03.07.2017while (true)
- person Chris G   schedule 04.07.2017