Skip to content

Commit bdefa3b

Browse files
committed
feat: added utils functions to format dates
1 parent 9201a29 commit bdefa3b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lib/utils.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const formatDate = (date: Date) => {
2+
const formatter = new Intl.DateTimeFormat('en-US', {
3+
year: 'numeric',
4+
month: 'short',
5+
day: 'numeric',
6+
timeZone: 'UTC', // Default to UTC to prevent timezone issues
7+
});
8+
9+
// Ensure we're parsing the date correctly
10+
return formatter.format(new Date(date));
11+
}

0 commit comments

Comments
 (0)