feat: add "This year" period option to reports and dashboard
Adds a "year" period (Jan 1 to today) between "6 months" and "12 months" in the period selector across all reports and dashboard views. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d06153f472
commit
b46cad5888
7 changed files with 11 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
|||
### Added
|
||||
- Dynamic Report: fields can now be used in multiple zones simultaneously (rows + filters, columns + filters)
|
||||
- Dynamic Report: right-click on a filter value to exclude it (shown with strikethrough in red)
|
||||
- "This year" period option in reports and dashboard (Jan 1 to today)
|
||||
|
||||
## [0.3.9]
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
|||
import { Calendar } from "lucide-react";
|
||||
import type { DashboardPeriod } from "../../shared/types";
|
||||
|
||||
const PERIODS: DashboardPeriod[] = ["month", "3months", "6months", "12months", "all"];
|
||||
const PERIODS: DashboardPeriod[] = ["month", "3months", "6months", "year", "12months", "all"];
|
||||
|
||||
interface PeriodSelectorProps {
|
||||
value: DashboardPeriod;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,9 @@ function computeDateRange(
|
|||
case "6months":
|
||||
from = new Date(year, month - 5, 1);
|
||||
break;
|
||||
case "year":
|
||||
from = new Date(year, 0, 1);
|
||||
break;
|
||||
case "12months":
|
||||
from = new Date(year, month - 11, 1);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -124,6 +124,9 @@ function computeDateRange(
|
|||
case "6months":
|
||||
from = new Date(year, month - 5, 1);
|
||||
break;
|
||||
case "year":
|
||||
from = new Date(year, 0, 1);
|
||||
break;
|
||||
case "12months":
|
||||
from = new Date(year, month - 11, 1);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ function computeDateRange(
|
|||
case "month": from = new Date(year, month, 1); break;
|
||||
case "3months": from = new Date(year, month - 2, 1); break;
|
||||
case "6months": from = new Date(year, month - 5, 1); break;
|
||||
case "year": from = new Date(year, 0, 1); break;
|
||||
case "12months": from = new Date(year, month - 11, 1); break;
|
||||
default: from = new Date(year, month, 1); break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ function computeDateRange(
|
|||
case "month": from = new Date(year, month, 1); break;
|
||||
case "3months": from = new Date(year, month - 2, 1); break;
|
||||
case "6months": from = new Date(year, month - 5, 1); break;
|
||||
case "year": from = new Date(year, 0, 1); break;
|
||||
case "12months": from = new Date(year, month - 11, 1); break;
|
||||
default: from = new Date(year, month, 1); break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ export interface ImportReport {
|
|||
|
||||
// --- Dashboard Types ---
|
||||
|
||||
export type DashboardPeriod = "month" | "3months" | "6months" | "12months" | "all" | "custom";
|
||||
export type DashboardPeriod = "month" | "3months" | "6months" | "year" | "12months" | "all" | "custom";
|
||||
|
||||
export interface DashboardSummary {
|
||||
totalCount: number;
|
||||
|
|
|
|||
Loading…
Reference in a new issue