datahub/site/lib/formatDate.ts
João Demenech 5c8431bf39
Fix code blocks not being displayed properly on light mode (#851)
* [#803,blogs][m]: fix code blocks not being displayed properly on light mode

* [docs][m] - fix problems with merge

---------

Co-authored-by: Luccas Mateus <Luccasmmg@gmail.com>
2023-05-06 13:36:49 -03:00

8 lines
242 B
TypeScript

export const formatDate = (date: string, locales = "en-US") => {
const options: Intl.DateTimeFormatOptions = {
year: "numeric",
month: "long",
day: "numeric",
};
return new Date(date).toLocaleDateString(locales, options);
};