From 5ace9b86d84cecc1b066dd13953e83bef54e9d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B1=95=E9=B9=8F?= Date: Sat, 6 Dec 2025 01:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E6=9C=9F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98=EF=BC=9A?= =?UTF-8?q?1)=E5=9C=A8index.php=E4=B8=AD=E4=BD=BF=E7=94=A8=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E6=97=B6=E5=8C=BA=E8=8E=B7=E5=8F=96=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=EF=BC=8C=E9=81=BF=E5=85=8DtoISOStri?= =?UTF-8?q?ng()=E5=AF=BC=E8=87=B4=E7=9A=84=E6=97=B6=E5=8C=BA=E5=81=8F?= =?UTF-8?q?=E5=B7=AE=EF=BC=9B2)=E5=9C=A8vip.php=E4=B8=AD=E5=90=8C=E6=A0=B7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4=E9=A2=84=E7=BA=A6=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E7=9A=84=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 11 +++++++++-- vip.php | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 03235c3..abfaeff 100644 --- a/index.php +++ b/index.php @@ -437,13 +437,20 @@ $packages_json = json_encode(array_map(function($package) { for (let dayOffset = 0; dayOffset < 7; dayOffset++) { const date = new Date(pageStartMonday); date.setDate(pageStartMonday.getDate() + dayOffset); - const dateStr = date.toISOString().split('T')[0]; + // 确保使用本地时区获取日期字符串 + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const dateStr = `${year}-${month}-${day}`; const dateDisplay = `${date.getMonth() + 1}/${date.getDate()}`; const weekday = ['日', '一', '二', '三', '四', '五', '六'][date.getDay()]; // 获取今天的日期字符串用于比较 const today = new Date(); - const todayStr = today.toISOString().split('T')[0]; + const todayYear = today.getFullYear(); + const todayMonth = String(today.getMonth() + 1).padStart(2, '0'); + const todayDay = String(today.getDate()).padStart(2, '0'); + const todayStr = `${todayYear}-${todayMonth}-${todayDay}`; const isToday = dateStr === todayStr; // 获取预约数量 diff --git a/vip.php b/vip.php index e384a31..d22cb9f 100644 --- a/vip.php +++ b/vip.php @@ -922,7 +922,11 @@ try { document.getElementById('booking_car_number').value = carNumber || ''; // 设置默认预约日期为今天 - document.getElementById('booking_date').value = new Date().toISOString().split('T')[0]; + const today = new Date(); + const year = today.getFullYear(); + const month = String(today.getMonth() + 1).padStart(2, '0'); + const day = String(today.getDate()).padStart(2, '0'); + document.getElementById('booking_date').value = `${year}-${month}-${day}`; // 清空其他字段 document.getElementById('booking_time_slot').value = '';