Commit
·
02bf005
1
Parent(s):
ecba77a
show trailing 12 months not calendar year
Browse files- src/pages/index.tsx +4 -2
src/pages/index.tsx
CHANGED
|
@@ -36,10 +36,12 @@ export default function Home() {
|
|
| 36 |
);
|
| 37 |
|
| 38 |
const today = new Date();
|
| 39 |
-
const
|
|
|
|
|
|
|
| 40 |
|
| 41 |
// generate daily data for each provider
|
| 42 |
-
for (let d = new Date(
|
| 43 |
const dateString = d.toISOString().split('T')[0];
|
| 44 |
|
| 45 |
Object.entries(PROVIDERS_MAP).forEach(([provider, { authors }]) => {
|
|
|
|
| 36 |
);
|
| 37 |
|
| 38 |
const today = new Date();
|
| 39 |
+
const startDate = new Date(today);
|
| 40 |
+
startDate.setMonth(today.getMonth() - 11);
|
| 41 |
+
startDate.setDate(1); // start from the first day of the month
|
| 42 |
|
| 43 |
// generate daily data for each provider
|
| 44 |
+
for (let d = new Date(startDate); d <= today; d.setDate(d.getDate() + 1)) {
|
| 45 |
const dateString = d.toISOString().split('T')[0];
|
| 46 |
|
| 47 |
Object.entries(PROVIDERS_MAP).forEach(([provider, { authors }]) => {
|