From 52b4f0cc1a9ee7e0ae4f8d79bfbeebf1d89bc04d Mon Sep 17 00:00:00 2001 From: Tomas <tomasysh@gmail.com> Date: 星期六, 05 八月 2023 17:13:11 +0800 Subject: [PATCH] Fixed: [弱掃] p11.1 Bad use of null-like value --- 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