Skip to content

Commit 044319a

Browse files
committed
Fix tests in CI
1 parent b62a8a3 commit 044319a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/common/format-date.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export function formatDate(date) {
1+
export function formatDate(date, locale) {
22
const now = new Date();
33

44
// normalize to local midnight for date-only comparison
@@ -8,15 +8,15 @@ export function formatDate(date) {
88

99
// Today: show just time
1010
if (diffDays === 0) {
11-
return date.toLocaleTimeString(undefined, {
11+
return date.toLocaleTimeString(locale, {
1212
hour: "numeric",
1313
minute: "2-digit"
1414
});
1515
}
1616

1717
// Yesterday: show "Yesterday, <time>"
1818
if (diffDays === 1) {
19-
const time = date.toLocaleTimeString(undefined, {
19+
const time = date.toLocaleTimeString(locale, {
2020
hour: "numeric",
2121
minute: "2-digit"
2222
});
@@ -26,7 +26,7 @@ export function formatDate(date) {
2626
// Otherwise: full date + time, omit year if same
2727
const sameYear = date.getFullYear() === now.getFullYear();
2828

29-
return date.toLocaleString(undefined, {
29+
return date.toLocaleString(locale, {
3030
year: sameYear ? undefined : "numeric",
3131
month: "short",
3232
day: "numeric",
@@ -35,8 +35,8 @@ export function formatDate(date) {
3535
});
3636
}
3737

38-
export function formatFullDate(date) {
39-
return date.toLocaleString(undefined, {
38+
export function formatFullDate(date, locale) {
39+
return date.toLocaleString(locale, {
4040
year: "numeric",
4141
month: "short",
4242
day: "numeric",

tests/folding.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,6 @@ Another paragraph here`)
662662
// Verify block is folded by checking for fold placeholder
663663
await expect(page.locator(".cm-foldPlaceholder")).toBeVisible()
664664

665-
await expect(page.locator(".cm-foldPlaceholder .created-time")).toHaveText(formatDate(date))
665+
await expect(page.locator(".cm-foldPlaceholder .created-time")).toHaveText(formatDate(date, "en-GB"))
666666
});
667667
});

0 commit comments

Comments
 (0)