(d)
| 48 | } |
| 49 | |
| 50 | export function getWeekArray (d) { |
| 51 | let dayArray = []; |
| 52 | let daysInMonth = getDaysInMonth(d); |
| 53 | let daysInWeek; |
| 54 | let emptyDays; |
| 55 | let firstDayOfWeek; |
| 56 | let week; |
| 57 | let weekArray = []; |
| 58 | |
| 59 | for (let i = 1; i <= daysInMonth; i++) { |
| 60 | dayArray.push(new Date(d.getFullYear(), d.getMonth(), i)); |
| 61 | } |
| 62 | |
| 63 | while (dayArray.length) { |
| 64 | firstDayOfWeek = dayArray[0].getDay(); |
| 65 | daysInWeek = 7 - firstDayOfWeek; |
| 66 | emptyDays = 7 - daysInWeek; |
| 67 | week = dayArray.splice(0, daysInWeek); |
| 68 | |
| 69 | for (let j = 0; j < emptyDays; j++) { |
| 70 | week.unshift(null); |
| 71 | } |
| 72 | |
| 73 | weekArray.push(week); |
| 74 | } |
| 75 | |
| 76 | return weekArray; |
| 77 | } |
| 78 | |
| 79 | export function isEqualDate (d1, d2) { |
| 80 | if (!d1 || !d2 || !(d1 instanceof Date) || !(d2 instanceof Date)) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…