Daily free market countdown fix
This commit is contained in:
parent
d0347ff5c2
commit
0f01753795
|
@ -5,6 +5,14 @@ import { User } from 'common/user'
|
|||
let sessionCreatedContractToday = true
|
||||
|
||||
export function getUtcFreeMarketResetTimeToday() {
|
||||
// Uses utc time like the server.
|
||||
const utcFreeMarketResetTime = new Date()
|
||||
utcFreeMarketResetTime.setUTCDate(utcFreeMarketResetTime.getUTCDate())
|
||||
const utcFreeMarketMS = utcFreeMarketResetTime.setUTCHours(16, 0, 0, 0)
|
||||
return utcFreeMarketMS
|
||||
}
|
||||
|
||||
function getUtcFreeMarketResetTimeYesterday() {
|
||||
// Uses utc time like the server.
|
||||
const utcFreeMarketResetTime = new Date()
|
||||
utcFreeMarketResetTime.setUTCDate(utcFreeMarketResetTime.getUTCDate() - 1)
|
||||
|
@ -19,7 +27,7 @@ export const useHasCreatedContractToday = (user: User | null | undefined) => {
|
|||
|
||||
useEffect(() => {
|
||||
setHasCreatedContractToday('loading')
|
||||
const todayAtMidnight = getUtcFreeMarketResetTimeToday()
|
||||
const todayAtMidnight = getUtcFreeMarketResetTimeYesterday()
|
||||
async function listUserContractsForToday() {
|
||||
if (!user) return
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user