From e6563737909f90da9cdb4fd023c8507a9b549516 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/ui/src/views/Space/Editor.vue b/apps/ui/src/views/Space/Editor.vue index 0a3427c6ce..7254ed7be0 100644 --- a/apps/ui/src/views/Space/Editor.vue +++ b/apps/ui/src/views/Space/Editor.vue @@ -31,6 +31,8 @@ const DISCUSSION_DEFINITION = { examples: ['e.g. https://forum.balancer.fi/t/proposal…'] }; +const NOW = Math.floor(Date.now() / 1000); + const props = defineProps<{ space: Space; }>(); @@ -175,9 +177,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 +236,7 @@ async function handleProposeClick() { choices, proposal.value.labels, appName.length <= 128 ? appName : '', + NOW, proposalStart.value, proposalMinEnd.value, proposalMinEnd.value,