From d56d1b2b76e5639006c5ce8aaedb5979e74fab70 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期三, 09 二月 2022 16:24:29 +0800
Subject: [PATCH] clean code

---
 PAMapp/components/Ui/UiDateFormat.vue |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/PAMapp/components/Ui/UiDateFormat.vue b/PAMapp/components/Ui/UiDateFormat.vue
index e9223b3..32f9651 100644
--- a/PAMapp/components/Ui/UiDateFormat.vue
+++ b/PAMapp/components/Ui/UiDateFormat.vue
@@ -13,7 +13,7 @@
     date!: Date | string;
 
     @Prop()
-    onlyShowSection!: 'DAY' | 'TIME';
+    onlyShowSection!: 'YEAR' | 'DATE' | 'DAY' | 'TIME';
 
     compareTarget!: Date;
     displayValue = '';
@@ -46,6 +46,12 @@
                         this.displayValue = isThisYear(compareTarget) ? thisYearDayLabel : `${compareTarget.getFullYear()}/${compareTarget.getMonth() + 1}/${compareTarget.getDate()}`;
                     } else if (this.onlyShowSection === 'TIME') {
                         this.displayValue = `${compareTarget.getHours()}:${minutes}`;
+                    } else if (this.onlyShowSection === 'DATE') {
+                        this.displayValue = isThisYear(compareTarget)
+                            ? thisYearDayLabel
+                            : `${compareTarget.getMonth() + 1}/${compareTarget.getDate()}`;
+                    } else if (this.onlyShowSection === 'YEAR') {
+                        this.displayValue = `${compareTarget.getFullYear()}`;
                     }
 
                     if (this.onlyShowSection) return;

--
Gitblit v1.8.0