Skip to content

Commit faa46d0

Browse files
committed
perf: added new functions for utility and changed types
1 parent 8ac5a9b commit faa46d0

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/lib/posts.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export type PostMetadata = {
2-
title: string
3-
description: string
4-
posted: Date
5-
tags: string[]
6-
slug?: string
2+
title?: string
3+
description?: string
4+
date?: string
5+
tags?: string[]
6+
slug: string
77
}
88

99
export type PostData = {

src/lib/utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ export function cn(...inputs: ClassValue[]) {
55
return twMerge(clsx(inputs));
66
}
77

8-
export const formattedDate = (d: Date): string => {
8+
export const formatDate = (d: Date): string => {
99
return new Intl.DateTimeFormat('en-US', {
1010
month: 'short',
1111
day: '2-digit',
1212
year: 'numeric'
1313
}).format(d);
1414
};
15+
16+
export const formatShortDate = (d: Date): string => {
17+
return new Intl.DateTimeFormat('en-US', {
18+
month: 'long',
19+
day: '2-digit',
20+
}).format(d);
21+
};

0 commit comments

Comments
 (0)