From 3817f80bad0ca9be3e45a620a37b0d33d6c0dff6 Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Sat, 24 Aug 2024 09:55:32 +0800
Subject: [PATCH] 修改:历史记录 韩国时间

---
 src/page/perpetualContract/orderDetail.vue |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/page/perpetualContract/orderDetail.vue b/src/page/perpetualContract/orderDetail.vue
index 7726437..d761fd1 100644
--- a/src/page/perpetualContract/orderDetail.vue
+++ b/src/page/perpetualContract/orderDetail.vue
@@ -56,11 +56,11 @@
             </div>
             <div class="flex justify-between pb-68">
                 <div class="text-grey">{{ $t('开仓时间') }}</div>
-                <div class="textColor">{{ detail.create_time }}</div>
+                <div class="textColor">{{ getnewtime(detail.create_time) }}</div>
             </div>
             <div class="flex justify-between pb-68">
                 <div class="text-grey">{{ $t('平仓时间') }}</div>
-                <div class="textColor">{{ detail.close_time }}</div>
+                <div class="textColor">{{ getnewtime(detail.close_time) }}</div>
             </div>
         </div>
     </div>
@@ -90,6 +90,29 @@
         }, 1000);
     },
     methods: {
+		getnewtime(e){
+		// 给定的时间字符串 (中国时间)
+		const inputDateStr = e;
+		
+		// 创建一个 Date 对象,注意这里输入的时间是 CST,实际上是 UTC+8
+		const inputDate = new Date(inputDateStr + ' UTC+0800');
+		
+		// 转换为韩国时间 (KST),KST = UTC + 9 小时
+		const kstDate = new Date(inputDate.getTime() + 1 * 60 * 60 * 1000); // 8小时 + 1小时 = 9小时
+		
+		// 获取年、月、日、小时、分钟和秒
+		const year = inputDate.getFullYear();
+		const month = inputDate.getMonth() + 1; // getMonth() 返回 0 到 11,需要加 1
+		const day = inputDate.getDate();
+		const hours = inputDate.getHours(); // 小时部分
+		const minutes = inputDate.getMinutes(); // 分钟部分
+		const seconds = inputDate.getSeconds(); // 秒部分
+		
+		// 格式化时间为“年-月-日 小时:分钟:秒”格式
+		const formattedDate = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
+		const formattedTime = `${hours}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
+					  return formattedDate +' '+ formattedTime
+			},
         handleText(state) {
             let str = '';
             if (state == 'created') {

--
Gitblit v1.9.3