From 5ab74a76ba6ec9ae62043ecde72a5530c0852276 Mon Sep 17 00:00:00 2001 From: Joeylene <23741509+jorenrui@users.noreply.github.com> Date: Thu, 23 Nov 2023 12:51:35 +0800 Subject: [PATCH] refactor: update code to contain declarations --- index.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index bd1d9d5..6c0fb33 100644 --- a/index.html +++ b/index.html @@ -381,20 +381,20 @@

AirBnB Search Bar:

:class="whenSelectedTab === 'Months' ? 'bg-white ring-1 ring-gray-300' : 'hover:bg-gray-300'" :click="whenSelectedTab = 'Months'; selectedTab = 'When'; - el.today = new Date(); - el.startMonth = el.today.getMonth() + 1; - el.endMonth = el.today.getMonth() + 1 + 3; + const today = new Date(); + const startMonth = today.getMonth() + 1; + const endMonth = today.getMonth() + 1 + 3; - el.startDate = new Date(el.today.getFullYear(), el.startMonth, 1); - el.endDate = new Date(el.today.getFullYear(), el.endMonth, 1); + const startDate = new Date(today.getFullYear(), startMonth, 1); + const endDate = new Date(today.getFullYear(), endMonth, 1); - time = el.startDate.toLocaleString('default', { + time = startDate.toLocaleString('default', { month: 'short', year: 'numeric', day: 'numeric', }); time += ' - '; - time += el.endDate.toLocaleString('default', { + time += endDate.toLocaleString('default', { month: 'short', year: 'numeric', day: 'numeric',