Skip to content

Commit 2bca0f9

Browse files
committed
🤖 fix: use regional locale for build date display
Replace hardcoded US date format (MM/DD/YYYY) with toLocaleDateString() to respect the user's regional settings. The formatUSDate function now uses formatLocalDate which automatically adapts to the user's locale. _Generated with `mux`_
1 parent 4d1947a commit 2bca0f9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/browser/components/TitleBar.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ function hasBuildInfo(value: unknown): value is VersionMetadata {
3434
return typeof candidate.buildTime === "string";
3535
}
3636

37-
function formatUSDate(isoDate: string): string {
37+
function formatLocalDate(isoDate: string): string {
3838
const date = new Date(isoDate);
39-
const month = String(date.getUTCMonth() + 1).padStart(2, "0");
40-
const day = String(date.getUTCDate()).padStart(2, "0");
41-
const year = date.getUTCFullYear();
42-
return `${month}/${day}/${year}`;
39+
return date.toLocaleDateString(undefined, {
40+
year: "numeric",
41+
month: "2-digit",
42+
day: "2-digit",
43+
});
4344
}
4445

4546
function formatExtendedTimestamp(isoDate: string): string {
@@ -61,7 +62,7 @@ function parseBuildInfo(version: unknown) {
6162
const gitDescribe = typeof git_describe === "string" ? git_describe : undefined;
6263

6364
return {
64-
buildDate: formatUSDate(buildTime),
65+
buildDate: formatLocalDate(buildTime),
6566
extendedTimestamp: formatExtendedTimestamp(buildTime),
6667
gitDescribe,
6768
};

0 commit comments

Comments
 (0)