Skip to content

Commit f14c08d

Browse files
authored
🤖 fix: use regional locale for build date display (#930)
Replace hardcoded US date format (MM/DD/YYYY) with `toLocaleDateString()` to respect the user's regional settings. ## Changes - Renamed `formatUSDate` → `formatLocalDate` - Uses `toLocaleDateString(undefined, {...})` with `undefined` locale to automatically use the user's system locale - Maintains the same date components (year, month, day) but adapts ordering and separators to regional conventions **Examples:** - US: 12/05/2025 - UK/EU: 05/12/2025 - Germany: 05.12.2025 - Japan: 2025/12/05 _Generated with `mux`_
1 parent 4d1947a commit f14c08d

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)