Skip to content

Commit 1f130e1

Browse files
committed
fix: allow all date types
1 parent f434683 commit 1f130e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/utils/text.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ export const formatPhone = (input: string, separator = '-') => {
110110
return phone
111111
}
112112

113-
export function formatDate(date: string, locale = 'en-us') {
113+
export function formatDate(date: number | string | Date, locale = 'en-us') {
114114
return new Date(date).toLocaleDateString(locale, {
115115
year: 'numeric',
116116
month: 'long',
117117
day: 'numeric',
118118
})
119119
}
120120

121-
export function formatDateTime(date: string, locale = 'en-us') {
121+
export function formatDateTime(date: number | string | Date, locale = 'en-us') {
122122
return new Date(date).toLocaleString(locale, {
123123
year: 'numeric',
124124
month: 'long',

0 commit comments

Comments
 (0)