서버쪽에서 저장되기전에 아예 날짜를 포맷시켜주고 저장시켜주려 이렇게 작성했습니다.
let now = new Date();
let yearNum = now.getFullYear();
let month = now.getMonth() + 1;
let date = now.getDate();
let year = yearNum.toString();
let newYear = parseInt(year.substr(2, 3));
let fullDate = '';
// fullDate += newYear + '.' + month + '.' + date;
fullDate = `${newYear}.${month}.${date}`;
console.log(fulltDate) => 23.3.7
console.log(typeof fullDate) => string
근데 콘솔에 적혀있다시피 string입니다.
그래서 그런지 find.sort(-1)가 안먹습니다.
그래서 그럼 저장시켜주기전에 문자열을 숫자로 바꿔주자해서
console.log(parseInt( fullDate));
이렇게해봣는데 콘솔출력값은 23만 출력되고있습니다.
아마도 '23.3.7' 이거를 숫자로 변환시켜주는 과정에서 23. <- . 을 만나서 소수점을 뺴버린다고생각해서 이렇게된거같은데..
parseFloat(fullDate) 을쓰면 23.3까지는 출력이되네요..
이럴땐 어떤방법을써야할까요?