moment 포맷

2020. 4. 11. 03:52Node.js, Express

데이터를 Date타입으로 변경해 줄때 moment 함수를 

moment(A).format("YYYY-MM-DD HH:mm:ss"); 이런식으로 

썼는데 계속해서 

Deprecation warning: value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.

 

Moment.js | Guides

The moment object in Moment.js is mutable. This means that operations like add, subtract, or set change the original moment object. When first using Moment.js many developers are confused by scenarios like this: var a = moment('2016-01-01'); var b = a.add(

momentjs.com

이런 오류가 계속 떠서 구글링을 해보니

moment.utc(A,'YYYY-MM-DD HH:mm:ss'); 포맷을 이런식으로 해야 한다고 한다.

 

moment.js는 개발이 중단됬으니 dayjs로 바꿔서 사용하자
crispypotato.tistory.com/88

728x90
반응형