[typescript] Date 관련 타입스크립트 오류

KoEunseo·2023년 1월 15일
0

fixErr

목록 보기
19/23

The left-hand side of an arithmetic operation must be type 'any', 'number', 'bigint' or an enum type

before

const base = Math.ceil((sendDay - today) / (1000 * 60 * 60 * 24));

solution: .getTime() 메서드 사용

const base = Math.ceil((sendDay.getTime() - today.getTime()) / (1000 * 60 * 60 * 24));

Type 'string' is not assignable to type 'number'.ts(2322)

Number()로 감싸준다.

profile
주니어 플러터 개발자의 고군분투기

0개의 댓글