* Get the date range for the last calendar month * @returns {{from: string, to: string}}
()
| 86 | * @returns {{from: string, to: string}} |
| 87 | */ |
| 88 | function getLastMonthDateRange() { |
| 89 | const now = new Date(); |
| 90 | // First day of last month at 00:00:00 UTC |
| 91 | const from = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() - 1, 1, 0, 0, 0)); |
| 92 | // Last day of last month at 23:59:59 UTC |
| 93 | const to = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 0, 23, 59, 59)); |
| 94 | return { |
| 95 | from: from.toISOString(), |
| 96 | to: to.toISOString(), |
| 97 | }; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Make request to GitHub API (authenticated or unauthenticated) |