We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 160c3d3 commit 681c215Copy full SHA for 681c215
src/lib/utils/date.ts
@@ -7,11 +7,11 @@ export const isValidDate = (dateString?: string | number): boolean => {
7
return !isNaN(date.getTime())
8
}
9
10
-export const formatDate = (date: string) => {
+export const formatDate = (date: string, locale: string = "en-US") => {
11
if (/^\d{4}$/.test(date)) {
12
return date
13
14
- return new Date(date).toLocaleDateString("en-US", {
+ return new Date(date).toLocaleDateString(locale, {
15
month: "long",
16
day: "numeric",
17
year: "numeric",
0 commit comments