first commit
This commit is contained in:
14
frontend/app/utils/mapping-functions/date-format/index.ts
Normal file
14
frontend/app/utils/mapping-functions/date-format/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export function formatDate(inputDate: string | null | undefined): string {
|
||||
if (!inputDate) return "";
|
||||
|
||||
const date = new Date(inputDate);
|
||||
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
|
||||
const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
const month = monthNames[date.getMonth()];
|
||||
|
||||
const year = date.getFullYear();
|
||||
|
||||
return `${day}-${month}-${year}`;
|
||||
}
|
||||
Reference in New Issue
Block a user