Skip to content

Commit 4830c70

Browse files
authored
Merge pull request #253 from beNative/codex/ensure-caption-is-always-in-english
Ensure Last Saved caption uses English locale
2 parents d43bfac + 7f993dc commit 4830c70

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

components/StatusBar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ const RELATIVE_TIME_DIVISIONS: { amount: number; unit: Intl.RelativeTimeFormatUn
6666
{ amount: Number.POSITIVE_INFINITY, unit: 'year' },
6767
];
6868

69+
const LAST_SAVED_LOCALE = 'en-US';
70+
6971
interface ZoomButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
7072
hint: string;
7173
icon: React.ReactNode;
@@ -208,8 +210,8 @@ const StatusBar: React.FC<StatusBarProps> = ({
208210
return { fallback: 'Invalid date' };
209211
}
210212

211-
const absolute = date.toLocaleString();
212-
const formatter = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' });
213+
const absolute = date.toLocaleString(LAST_SAVED_LOCALE);
214+
const formatter = new Intl.RelativeTimeFormat(LAST_SAVED_LOCALE, { numeric: 'auto' });
213215
let duration = Math.round((date.getTime() - Date.now()) / 1000);
214216

215217
for (const division of RELATIVE_TIME_DIVISIONS) {

0 commit comments

Comments
 (0)