refactor: format Coco server update time in settings (#1040)

Previously, the last update time of the Coco server in the
"Connect" settings page was displayed using the raw string
directly from the `updated` field, which lacked consistent
formatting.

This commit refactors the `ServiceMetadata` component to use
the `formatDateToLocal` utility function. This ensures
the update time is displayed in a standardized
`YYYY/MM/DD HH:mm:ss` format and provides a fallback value if
the date is invalid or missing.
This commit is contained in:
SteveLauC
2025-12-31 14:04:45 +08:00
committed by GitHub
parent 81a8631411
commit a6b6a09af0
2 changed files with 3 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ Information about release notes of Coco App is provided here.
### ✈️ Improvements
- refactor: add a timeout to open() #1025
- refactor: format Coco server update time in settings #1040
## 0.10.0 (2025-12-19)

View File

@@ -2,6 +2,7 @@ import { memo } from "react";
import { PackageOpen, GitFork, CalendarSync } from "lucide-react";
import { useConnectStore } from "@/stores/connectStore";
import { formatDateToLocal } from "@/utils/date";
interface ServiceMetadataProps {}
@@ -20,7 +21,7 @@ const ServiceMetadata = memo(({}: ServiceMetadataProps) => {
</span>
<span className="mx-4">|</span>
<span className="flex items-center gap-1">
<CalendarSync className="w-4 h-4" /> {cloudSelectService?.updated}
<CalendarSync className="w-4 h-4" /> {formatDateToLocal(cloudSelectService?.updated)}
</span>
</div>
<p className="text-gray-600 dark:text-gray-300 leading-relaxed">