From c99a662edbd0c23e5c88e8a1531f9b10af6539d8 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期五, 21 一月 2022 16:47:03 +0800
Subject: [PATCH] Fixed#134576 修正 [ 顧問管理流程 ] 未聯絡預約單資訊明細 : 應只顯示「傳送約訪通知」按鈕,目前畫面顯示結案、約訪紀錄、系統通知紀錄編輯

---
 PAMapp/plugins/filters/date.filter.ts |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/PAMapp/plugins/filters/date.filter.ts b/PAMapp/plugins/filters/date.filter.ts
index 7c3670c..daa1f12 100644
--- a/PAMapp/plugins/filters/date.filter.ts
+++ b/PAMapp/plugins/filters/date.filter.ts
@@ -1,8 +1,18 @@
 import Vue from 'vue'
 
-Vue.filter('formatDate', (value: string): string => {
-  const date = new Date(value);
+Vue.filter('formatDate', (value: string | Date | null): string => {
+  let date: Date;
   const today = new Date();
+
+  if (!value) {
+    return '撠蝝����';
+  };
+
+  if (typeof value === 'string') {
+    date = new Date(value);
+  } else {
+    date = value;
+  };
 
   const isToday = (compareDate: Date): boolean => {
     return compareDate.getFullYear() === today.getFullYear()
@@ -12,14 +22,16 @@
 
   const isThisYear = (compareDate: Date): boolean => {
     return compareDate.getFullYear() === today.getFullYear();
-  }
+  };
+
+  const minutes = date.getMinutes() > 9 ?  date.getMinutes() : `0${date.getMinutes()}`;
 
   if (isThisYear(date)) {
     return isToday(date)
-          ? `隞予 ${date.getHours()}:${date.getMinutes()}`
-          : `${date.getMonth() + 1}���${date.getDate()}� ${date.getHours()}:${date.getMinutes()}`;
+          ? `隞予 ${date.getHours()}:${minutes}`
+          : `${date.getMonth() + 1}/${date.getDate()} ${date.getHours()}:${minutes}`;
   } else {
-    return `${date.getFullYear()}撟�${date.getMonth() + 1}���${date.getDate()}� ${date.getHours()}:${date.getMinutes()}`;
-  }
+    return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()} ${date.getHours()}:${minutes}`;
+  };
 
 })

--
Gitblit v1.8.0