Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

fix retention report invalid date

Francis Cao7582670aef1b
diff --git a/src/app/(main)/reports/retention/RetentionTable.tsx b/src/app/(main)/reports/retention/RetentionTable.tsx
index 171c5bd3f..1770a7646 100644
--- a/src/app/(main)/reports/retention/RetentionTable.tsx
+++ b/src/app/(main)/reports/retention/RetentionTable.tsx
@@ -52,7 +52,7 @@ export function RetentionTable({ days = DAYS }) {
{rows.map(({ date, visitors, records }, rowIndex) => {
return (
<div key={rowIndex} className={styles.row}>
- <div className={styles.date}>{formatDate(`${date} 00:00:00`, 'PP', locale)}</div>
+ <div className={styles.date}>{formatDate(date, 'PP', locale)}</div>
<div className={styles.visitors}>{visitors}</div>
{days.map(day => {
if (totalDays - rowIndex < day) {
diff --git a/src/pages/api/reports/retention.ts b/src/pages/api/reports/retention.ts
index 6ff7bbe1c..f4d9b7df0 100644
--- a/src/pages/api/reports/retention.ts
+++ b/src/pages/api/reports/retention.ts
@@ -9,7 +9,8 @@ import * as yup from 'yup';
export interface RetentionRequestBody {
websiteId: string;
- dateRange: { startDate: string; endDate: string; timezone: string };
+ dateRange: { startDate: string; endDate: string };
+ timezone: string;
}
const schema = {
@@ -20,9 +21,9 @@ const schema = {
.shape({
startDate: yup.date().required(),
endDate: yup.date().required(),
- timezone: TimezoneTest,
})
.required(),
+ timezone: TimezoneTest,
}),
};
@@ -37,7 +38,8 @@ export default async (
if (req.method === 'POST') {
const {
websiteId,
- dateRange: { startDate, endDate, timezone },
+ dateRange: { startDate, endDate },
+ timezone,
} = req.body;
if (!(await canViewWebsite(req.auth, websiteId))) {