Issue
is there any way to create calendar days in angular?
for example, I can render what day is today but I do not know how to generate the whole week.
so this is what I have but I need for the whole week
here is the code for his picture
<div class="date">
<span class="weekDay">{{today | date:'EEE' }}</span>
<span class="dayNum">{{today | date:'d'}}</span>
<span class="month">{{today | date:'MMM' }}</span>
</div>
Solution
you has "getDay" to know the week day of a date (see that 0 is Sunday). Some like
date=new Date()
incr=this.date.getDay()?this.date.getDay()-1:6
monday=new Date(this.date.getTime()-this.incr*24*60*60*1000)
week=[0,1,2,3,4,5,6].map(x=>new Date(this.monday.getTime()+x*24*60*60*1000))
give you a array week with the dates from Monday
If your week starts in Sunday you need change the incr.
NOTE: you can also check this SO to create a full calendar