this repo has no description
1export function formatDate(dateStr: string): string {
2 const date = new Date(dateStr);
3 const year = date.getFullYear();
4 const month = String(date.getMonth() + 1).padStart(2, "0");
5 const day = String(date.getDate()).padStart(2, "0");
6 return `${year}-${month}-${day}`;
7}
8
9export function formatDateTime(dateStr: string): string {
10 const date = new Date(dateStr);
11 const year = date.getFullYear();
12 const month = String(date.getMonth() + 1).padStart(2, "0");
13 const day = String(date.getDate()).padStart(2, "0");
14 const hours = String(date.getHours()).padStart(2, "0");
15 const minutes = String(date.getMinutes()).padStart(2, "0");
16 return `${year}-${month}-${day} ${hours}:${minutes}`;
17}