Refactor part 2: Electric Boogaloo. Standardize way of passing filter parameters.
This commit is contained in:
1 parent
f26f1b0581
commit
cdf391d5c2
90 files changed
+867
-709
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { useDateRange } from './useDateRange';
|
||||
import { useTimezone } from './useTimezone';
|
||||
|
||||
export function useDateParameters(websiteId: string) {
|
||||
const {
|
||||
dateRange: { startDate, endDate, unit },
|
||||
} = useDateRange(websiteId);
|
||||
const { timezone, toUtc } = useTimezone();
|
||||
|
||||
return {
|
||||
startAt: +toUtc(startDate),
|
||||
endAt: +toUtc(endDate),
|
||||
startDate: toUtc(startDate).toISOString(),
|
||||
endDate: toUtc(endDate).toISOString(),
|
||||
unit,
|
||||
timezone,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user