Convert local time to timezone.

This commit is contained in:
Mike Cao 2024-03-29 16:56:19 -07:00
parent 490e446481
commit a4d8afe516
6 changed files with 28 additions and 55 deletions

View file

@ -1,3 +1,4 @@
import { zonedTimeToUtc } from 'date-fns-tz';
import { useApi, useDateRange, useNavigation, useTimezone } from 'components/hooks';
export function useWebsitePageviews(websiteId: string, options?: { [key: string]: string }) {
@ -10,8 +11,8 @@ export function useWebsitePageviews(websiteId: string, options?: { [key: string]
} = useNavigation();
const params = {
startAt: +startDate,
endAt: +endDate,
startAt: +zonedTimeToUtc(startDate, timezone),
endAt: +zonedTimeToUtc(endDate, timezone),
unit,
timezone,
url,