From c7bb3dc02fabe0905588d42b7a2ba230c2325c00 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:58:40 +0800 Subject: [PATCH] fix: use single source of truth for current time --- apps/ui/src/views/Space/Editor.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/ui/src/views/Space/Editor.vue b/apps/ui/src/views/Space/Editor.vue index 0a3427c6c..a8b8f2965 100644 --- a/apps/ui/src/views/Space/Editor.vue +++ b/apps/ui/src/views/Space/Editor.vue @@ -15,6 +15,7 @@ import { getNetwork, offchainNetworks } from '@/networks'; import { Contact, Space, Transaction, VoteType } from '@/types'; const DEFAULT_VOTING_DELAY = 60 * 60 * 24 * 3; +const NOW = Math.floor(Date.now() / 1000); const TITLE_DEFINITION = { type: 'string', @@ -175,9 +176,7 @@ const proposalLimitReached = computed( const propositionPower = computed(() => getPropositionPower(props.space)); -const proposalStart = computed( - () => Math.floor(Date.now() / 1000) + props.space.voting_delay -); +const proposalStart = computed(() => NOW + props.space.voting_delay); const proposalMinEnd = computed( () => @@ -236,6 +235,7 @@ async function handleProposeClick() { choices, proposal.value.labels, appName.length <= 128 ? appName : '', + NOW, proposalStart.value, proposalMinEnd.value, proposalMinEnd.value,