Skip to content

Commit

Permalink
date
Browse files Browse the repository at this point in the history
  • Loading branch information
woo-jk committed Jul 22, 2024
1 parent 616c404 commit 6e26999
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/(sidebar)/(my-info)/components/InfoCardItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const TAG_TYPE_COLOR = {
} as const;

export function InfoCardItem({ title, updatedDate, cardTagList }: Props) {
const formattedDate = formatToYYMMDD(updatedDate);
const formattedDate = formatToYYMMDD(updatedDate, '.');

return (
<div className="flex flex-col justify-between min-w-[343px] h-[140px] p-[24px] rounded-[16px] bg-white border border-neutral-5 cursor-pointer hover:border-neutral-30">
Expand Down
4 changes: 2 additions & 2 deletions src/utils/date.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const formatToYYMMDD = (dateString: string) => {
export const formatToYYMMDD = (dateString: string, separator: string = '') => {
const date = new Date(dateString);

const yy = String(date.getFullYear()).slice(-2);
const mm = String(date.getMonth() + 1).padStart(2, '0');
const dd = String(date.getDate()).padStart(2, '0');

return `${yy}.${mm}.${dd}`;
return [yy, mm, dd].join(separator);
};

0 comments on commit 6e26999

Please sign in to comment.