sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
14 lines (10 loc) • 376 B
text/typescript
import {endOfDay, startOfDay} from 'date-fns'
import {useCallback} from 'react'
import useTimeZone from '../../../scheduledPublishing/hooks/useTimeZone'
export const useTimezoneAdjustedDateTimeRange = () => {
const {zoneDateToUtc} = useTimeZone()
return useCallback(
(date: Date) => [startOfDay(date), endOfDay(date)].map(zoneDateToUtc),
[zoneDateToUtc],
)
}