From 84bb9b5e78ef9570442b72ae49b7b3f354ff20ce Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Thu, 22 Jun 2023 12:31:47 +0530 Subject: [PATCH] Revert "feat(proposal): add validation to start time (#3991)" (#4010) This reverts commit abf53c7d9561d4f5f05bdd7bb592d346cb4ea1b3. --- src/components/ModalSelectDate.vue | 35 ++++-------------------------- src/locales/default.json | 3 +-- src/views/SpaceCreate.vue | 3 +-- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/src/components/ModalSelectDate.vue b/src/components/ModalSelectDate.vue index 61bfab329ea..2650b185357 100644 --- a/src/components/ModalSelectDate.vue +++ b/src/components/ModalSelectDate.vue @@ -11,16 +11,6 @@ const { open } = toRefs(props); const step = ref(0); const input = ref(''); const time = ref('12:00'); -const isTimeValid = computed(() => { - const isTimeEnteringStep = step.value === 1; - if (!isTimeEnteringStep) return true; - if (!input.value) return false; - - const startDateString = `${input.value} ${time.value}:59`; - const startTimestamp = new Date(startDateString).getTime(); - - return startTimestamp >= Date.now(); -}); function formatDate(date) { const output = { h: '12', m: '00', dateString: '' }; @@ -38,8 +28,7 @@ function handleSubmit() { if (step.value === 0) return (step.value = 1); const dateString = `${input.value} ${time.value}:00`; const timestamp = new Date(dateString).getTime() / 1000; - const now = parseInt((Date.now() / 1e3).toFixed()); - emit('input', Math.max(timestamp, now)); + emit('input', timestamp); emit('close'); } @@ -50,17 +39,6 @@ watch(open, () => { time.value = `${h}:${m}`; input.value = dateString; }); - -watch(step, () => { - if (step.value === 0) return; - const timestamp = Math.max( - props.value, - parseInt((Date.now() / 1e3 + 10).toFixed()) - ); - const { dateString, h, m } = formatDate(timestamp); - time.value = `${h}:${m}`; - input.value = dateString; -});