diff --git a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.test.tsx b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.test.tsx index 711c9f5795..798e7d2328 100644 --- a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.test.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.test.tsx @@ -29,7 +29,7 @@ test('Display extended daily metrics', async () => { userEvent.click(intialSelectedValue); - const newSelectedValue = await screen.findByText('Last week'); + const newSelectedValue = await screen.findByText('Last 7 days'); userEvent.click(newSelectedValue); diff --git a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.tsx b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.tsx index b011bde595..60824f9ec9 100644 --- a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.tsx @@ -2,7 +2,6 @@ import { styled } from '@mui/material'; import GeneralSelect, { IGeneralSelectProps, } from 'component/common/GeneralSelect/GeneralSelect'; -import { subWeeks, subMonths, differenceInHours } from 'date-fns'; import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; import { useExtendedFeatureMetrics } from '../useExtendedFeatureMetrics'; @@ -74,20 +73,15 @@ const now = new Date(); const daysOptions: { key: `${number}`; label: string }[] = [ { - key: `${differenceInHours(now, subWeeks(now, 1))}`, - label: 'Last week', + key: `${7 * 24}`, + label: 'Last 7 days', }, { - key: `${differenceInHours(now, subMonths(now, 1))}`, - label: 'Last month', + key: `${30 * 24}`, + label: 'Last 30 days', }, { - key: `${differenceInHours(now, subMonths(now, 3))}`, - label: 'Last 3 months', + key: `${90 * 24}`, + label: 'Last 90 days', }, ]; - -export const FEATURE_METRIC_HOURS_BACK_MAX = differenceInHours( - now, - subMonths(now, 3), -); diff --git a/src/lib/create-config.ts b/src/lib/create-config.ts index 4cc2ff2c01..c5383d029a 100644 --- a/src/lib/create-config.ts +++ b/src/lib/create-config.ts @@ -553,7 +553,7 @@ export function createConfig(options: IUnleashOptions): IUnleashConfig { const dailyMetricsStorageDays = Math.min( parseEnvVarNumber(process.env.DAILY_METRICS_STORAGE_DAYS, 31), - 92, + 91, ); return { diff --git a/src/lib/features/metrics/client-metrics/client-metrics.ts b/src/lib/features/metrics/client-metrics/client-metrics.ts index 17db5aa48a..14ab245b27 100644 --- a/src/lib/features/metrics/client-metrics/client-metrics.ts +++ b/src/lib/features/metrics/client-metrics/client-metrics.ts @@ -39,7 +39,7 @@ class ClientMetricsController extends Controller { private static HOURS_BACK_MAX = 48; - private static HOURS_BACK_MAX_V2 = 24 * 31 * 3; // 3 months + private static HOURS_BACK_MAX_V2 = 24 * 91; // 91 days constructor( config: IUnleashConfig,