Skip to content

feat: add weekday to dates #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cypress/e2e/date-poll.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ describe("Poll creation page /poll/new", () => {
// Check dates order
cy.get(".dates .date-title").then((els) => {
expect(els).to.have.length(3);
const expectedDates = ["7 mai 2024", "13 mai 2024", "24 juillet 2024"];
const expectedDates = [
"mardi 7 mai 2024",
"lundi 13 mai 2024",
"mercredi 24 juillet 2024",
];
expectedDates.forEach((date, i) => {
cy.wrap(els[i]).should("have.text", date);
});
Expand Down
9 changes: 6 additions & 3 deletions website/utils/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
* @example "15 mai 2024"
*/
export function formatDate(date: Date | string) {
return Intl.DateTimeFormat("fr-FR", { dateStyle: "long" }).format(
new Date(date),
);
return Intl.DateTimeFormat("fr-FR", {
weekday: "long",
day: "numeric",
month: "long",
year: "numeric",
}).format(new Date(date));
}

/**
Expand Down