본문 바로가기

개발자정보

This expression is not callable. Type 'typeof import("X:/xxx/node_modules/date-fns/format")' has no call signatures.

반응형

 

 

 

오류발생 부분

export function formatDate(date: Date) {
  return format(date, 'yyyyMMdd') ;
}

 

 

수정

export function formatDate(date: Date): string {
  const day = date.getDate().toString().padStart(2, '0');
  const month = (date.getMonth() + 1).toString().padStart(2, '0');
  const year = date.getFullYear();
  return `${year}${month}${day}`;
  // return format(date, 'yyyyMMdd') ;
}
반응형