feat: 最後量測時間

This commit is contained in:
skytek_xinliang
2026-09-16 09:29:54 +08:00
parent 56dfb84890
commit 057bd335d6
4 changed files with 33 additions and 5 deletions
@@ -19,7 +19,7 @@
</div>
</v-card-title>
<v-card-subtitle> 顯示目前帳號各測驗項目的最新成績。 </v-card-subtitle>
<v-card-subtitle> 最後量測時間:{{ formattedReceivedAt }} </v-card-subtitle>
<v-card-text>
<v-progress-linear
@@ -86,6 +86,7 @@ const props = defineProps<{
error: string;
items: PhysicalFitnessItem[];
loading: boolean;
receivedAt: string | null;
}>();
defineEmits<{
@@ -125,6 +126,22 @@ const displayItems = computed(() =>
const completedCount = computed(
() => displayItems.value.filter((item) => item.fitnessScore !== null).length,
);
const formattedReceivedAt = computed(() => {
if (!props.receivedAt) {
return "無資料";
}
const receivedAt = new Date(props.receivedAt);
if (Number.isNaN(receivedAt.getTime())) {
return "無資料";
}
return new Intl.DateTimeFormat("zh-TW", {
dateStyle: "medium",
timeStyle: "short",
}).format(receivedAt);
});
</script>
<style scoped>