Skip to content

Commit

Permalink
fix monthly
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed May 2, 2024
1 parent 323f115 commit 1059b9c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/downloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ export function getWeeklyPeriod() {

export function getMonthlyPeriod() {
const today = new Date();
const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0); // Setting day as 0 goes to the last day of the previous month

const startDate = formatDate(firstDayOfMonth);
const endDate = formatDate(lastDayOfMonth);
const lastMonth = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 30);
const startDate = formatDate(lastMonth);
const endDate = formatDate(today);
return `${startDate}:${endDate}`;
}

Expand Down

0 comments on commit 1059b9c

Please sign in to comment.