Skip to content

Commit 80853f7

Browse files
committed
Exclude the current day from the PDF reporting period.
1 parent 7b0ed0c commit 80853f7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

assets/js/components/pdf-export/PDFExportOrchestrator.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import type {
4747
WidgetPDFConfig,
4848
} from '@/js/googlesitekit/widgets/types';
4949
import useViewOnly from '@/js/hooks/useViewOnly';
50+
import { getPreviousDate } from '@/js/util';
5051
import { getPDFFilename, triggerDownload } from './pdf-utils';
5152
import DashboardReport from './shared-react-pdf-components/DashboardReport';
5253
import type { PDFReportArea, PDFReportWidget } from './types';
@@ -214,8 +215,13 @@ const PDFExportOrchestrator: FC< PDFExportOrchestratorProps > = ( {
214215
const dates = useSelect(
215216
( select: Select ) =>
216217
select( CORE_USER ).getDateRangeDates( {
217-
offsetDays: 1,
218218
compare: true,
219+
// The PDF reporting period excludes the current day, so end the
220+
// range on the day before the reference date.
221+
referenceDate: getPreviousDate(
222+
select( CORE_USER ).getReferenceDate(),
223+
1
224+
),
219225
} ) as PDFReportDates,
220226
[]
221227
);

0 commit comments

Comments
 (0)