| | |
| | | } |
| | | htmlSegment += "</table>"; |
| | | return htmlSegment; |
| | | } |
| | | } |
| | | |
| | | export function verticalCalendar(calendar, location){ |
| | | const days = [ |
| | | [], |
| | | [], |
| | | [], |
| | | [], |
| | | [], |
| | | [], |
| | | [] |
| | | ]; |
| | | /* |
| | | 0 -> 1 |
| | | 1 -> 2 |
| | | 2 -> 3 |
| | | 3 -> 4 |
| | | 4 -> 5 |
| | | 5 -> 6 |
| | | 6 -> 0 |
| | | * */ |
| | | for(const [idx,day] of days.entries() ) { |
| | | const idxOfWeekdays = (idx + location.firstDayOfWeek) % 7; |
| | | const dayName = location.weekDays[idxOfWeekdays]; |
| | | day.push(`<td>${dayName}</td>`); |
| | | } |
| | | for(const week of calendar.weeks) { |
| | | for(const [idx, day] of week.entries() ) { |
| | | days[idx].push(`<td>${day}</td>`); |
| | | } |
| | | } |
| | | let cal = "<table>\n"; |
| | | for(const day of days) { |
| | | cal += "<tr>" + day.join("") + "</tr>\n" |
| | | } |
| | | cal += "</table>"; |
| | | return cal; |
| | | } |