Fix tooltip label, retention report for mysql, pass minDate into eventsChart

This commit is contained in:
Francis Cao 2024-08-27 16:02:43 -07:00
parent a5e2242486
commit ab050e51c5
4 changed files with 14 additions and 13 deletions

View file

@ -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>
);
})}

View file

@ -1,9 +1,8 @@
import { useMemo } from 'react';
import { useTheme } from 'components/hooks';
import Chart, { ChartProps } from 'components/charts/Chart';
import { renderNumberLabels } from 'lib/charts';
import { useState } from 'react';
import BarChartTooltip from 'components/charts/BarChartTooltip';
import Chart, { ChartProps } from 'components/charts/Chart';
import { useTheme } from 'components/hooks';
import { renderNumberLabels } from 'lib/charts';
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,

View file

@ -47,6 +47,8 @@ export function EventsChart({ websiteId, className }: EventsChartProps) {
return (
<BarChart
minDate={startDate.toISOString()}
maxDate={endDate.toISOString()}
className={className}
data={chartData}
unit={unit}

View file

@ -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 {