🐛 (typebot) Attempt to fix updatedAt comparison with different timezones
Closes #327
This commit is contained in:
@ -156,8 +156,8 @@ export const TypebotProvider = ({
|
|||||||
setLocalTypebot({ ...typebot }, { updateDate: false })
|
setLocalTypebot({ ...typebot }, { updateDate: false })
|
||||||
flush()
|
flush()
|
||||||
} else if (
|
} else if (
|
||||||
new Date(typebot.updatedAt) >
|
new Date(typebot.updatedAt).getTime() >
|
||||||
new Date(currentTypebotRef.current.updatedAt)
|
new Date(currentTypebotRef.current.updatedAt).getTime()
|
||||||
) {
|
) {
|
||||||
setLocalTypebot({ ...typebot })
|
setLocalTypebot({ ...typebot })
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
})
|
})
|
||||||
if (!typebot) return res.status(404).send({ message: 'Typebot not found' })
|
if (!typebot) return res.status(404).send({ message: 'Typebot not found' })
|
||||||
|
|
||||||
if ((typebot.updatedAt as Date) > new Date(data.updatedAt))
|
if (
|
||||||
|
(typebot.updatedAt as Date).getTime() > new Date(data.updatedAt).getTime()
|
||||||
|
)
|
||||||
return res.send({
|
return res.send({
|
||||||
message: 'Found newer version of the typebot in database',
|
message: 'Found newer version of the typebot in database',
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user