Skip to content

Commit

Permalink
get_since_until should return two dates not one
Browse files Browse the repository at this point in the history
  • Loading branch information
personofnorank committed Oct 4, 2024
1 parent 392cd0c commit 13c8ffa
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ export const parseDttmToDate = (
now.setMonth(now.getMonth() - 1);
}
return now;
case 'previous calendar quarter': {
const quarter = Math.floor(now.getMonth() / 3);
const newdate = new Date(now.getFullYear(), quarter * 3 - 3, 1);
return newdate;
}
case 'previous calendar quarter':
const quarter = Math.floor(now.getMonth() / 3);
const startquarter = new Date(now.getFullYear(), quarter * 3 - 3, 1);
const endquarter = new Date(startquarter.getFullYear(), startquarter.getMonth() + 3, 0);
if (isEndDate) {
return startquarter;
} else {
return endquarter;
}
case 'previous calendar year':
if (isEndDate) {
now.setFullYear(now.getFullYear(), 0, 1); // end date is the last day of the previous year
Expand Down

0 comments on commit 13c8ffa

Please sign in to comment.