use Date instead of dayjs

This commit is contained in:
Ian Philips 2022-04-28 19:31:43 -06:00
parent 4ec59be46f
commit 9e275a18f1

View File

@ -1,6 +1,5 @@
import { listContracts } from '../lib/firebase/contracts'
import { useEffect, useState } from 'react'
import dayjs from 'dayjs'
import { User } from '../../common/user'
export const useHasCreatedContractToday = (user: User | null | undefined) => {
@ -8,7 +7,8 @@ export const useHasCreatedContractToday = (user: User | null | undefined) => {
useEffect(() => {
// Uses utc time like the server.
const todayAtMidnight = dayjs.utc().startOf('day').valueOf()
const utcTimeString = new Date().toISOString()
const todayAtMidnight = new Date(utcTimeString).setUTCHours(0, 0, 0, 0)
async function listUserContractsForToday() {
if (!user) return