items-by-period (#2)

Reviewed-on: #2
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
This commit is contained in:
2026-05-09 13:00:42 +00:00
committed by aetos
parent f213a9455b
commit 77b60ba073
19 changed files with 574 additions and 357 deletions

View File

@@ -4,7 +4,9 @@ export {
export type {
Transaction,
ReportData,
ReportBucket,
ReportPeriod,
GroupKey,
} from './report.models'
export {
prepareReport

View File

@@ -73,14 +73,11 @@ function buildLabel(
end: Date
): string {
switch (type) {
case "weekly":
if (sameMonth(start, end)) {
const sDay = start.getUTCDate();
const eDay = end.getUTCDate();
const m = monthFmt.format(start);
return `${sDay} ${m} - ${eDay} ${m}`;
}
return `${dayFmt.format(start)} - ${dayFmt.format(end)}`;
case "weekly": {
const sDay = start.getUTCDate();
const m = monthFmt.format(start);
return `${sDay} ${m}`;
}
case "monthly":
return `${monthFmt.format(start)} ${yearFmt.format(start)}`;