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 tooltip label, retention report for mysql, pass minDate into eventsChart

Francis Caoab050e51c590
diff --git a/src/app/(main)/reports/retention/RetentionTable.tsx b/src/app/(main)/reports/retention/RetentionTable.tsx
index 1770a7646..acc9c052b 100644
--- a/src/app/(main)/reports/retention/RetentionTable.tsx
+++ b/src/app/(main)/reports/retention/RetentionTable.tsx
@@ -64,7 +64,7 @@ export function RetentionTable({ days = DAYS }) {
key={day}
className={classNames(styles.cell, { [styles.empty]: !percentage })}
>
- {percentage ? `${percentage.toFixed(2)}%` : ''}
+ {percentage ? `${Number(percentage).toFixed(2)}%` : ''}
</div>
);
})}
diff --git a/src/components/charts/BarChart.tsx b/src/components/charts/BarChart.tsx
index de7690468..7624ba1c4 100644
--- a/src/components/charts/BarChart.tsx
+++ b/src/components/charts/BarChart.tsx
@@ -1,9 +1,8 @@
-import { useMemo } from 'react';
-import { useTheme } from 'components/hooks';
+import BarChartTooltip from 'components/charts/BarChartTooltip';
import Chart, { ChartProps } from 'components/charts/Chart';
+import { useTheme } from 'components/hooks';
import { renderNumberLabels } from 'lib/charts';
-import { useState } from 'react';
-import BarChartTooltip from 'components/charts/BarChartTooltip';
+import { useMemo, useState } from 'react';
export interface BarChartProps extends ChartProps {
unit: string;
@@ -36,7 +35,7 @@ export function BarChart(props: BarChartProps) {
x: {
type: XAxisType,
stacked: true,
- min: unit === 'year' ? '' : minDate,
+ min: minDate && new Date(minDate).getSeconds() === 0 ? minDate : '',
max: maxDate,
time: {
unit,
diff --git a/src/components/metrics/EventsChart.tsx b/src/components/metrics/EventsChart.tsx
index ee7f866cb..f5b283449 100644
--- a/src/components/metrics/EventsChart.tsx
+++ b/src/components/metrics/EventsChart.tsx
@@ -47,6 +47,8 @@ export function EventsChart({ websiteId, className }: EventsChartProps) {
return (
<BarChart
+ minDate={startDate.toISOString()}
+ maxDate={endDate.toISOString()}
className={className}
data={chartData}
unit={unit}
diff --git a/src/lib/prisma.ts b/src/lib/prisma.ts
index f0f071bc7..32ac65eb5 100644
--- a/src/lib/prisma.ts
+++ b/src/lib/prisma.ts
@@ -14,17 +14,17 @@ const log = debug('umami:prisma');
const MYSQL_DATE_FORMATS = {
minute: '%Y-%m-%dT%H:%i:00',
hour: '%Y-%m-%d %H:00:00',
- day: '%Y-%m-%d',
- month: '%Y-%m-01',
- year: '%Y-01-01',
+ day: '%Y-%m-%d 00:00:00',
+ month: '%Y-%m-01 00:00:00',
+ year: '%Y-01-01 00:00:00',
};
const POSTGRESQL_DATE_FORMATS = {
minute: 'YYYY-MM-DD HH24:MI:00',
hour: 'YYYY-MM-DD HH24:00:00',
- day: 'YYYY-MM-DD',
- month: 'YYYY-MM-01',
- year: 'YYYY-01-01',
+ day: 'YYYY-MM-DD HH24:00:00',
+ month: 'YYYY-MM-01 HH24:00:00',
+ year: 'YYYY-01-01 HH24:00:00',
};
function getAddIntervalQuery(field: string, interval: string): string {