[node.js] Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. warning ํ•ด๊ฒฐํ•˜๊ธฐ

2021. 2. 17. 01:10ใ†๐Ÿ†‡ Error&๊ธฐํƒ€

๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ '2021.02.10' ์ด๋ผ๋Š” ๋‚ ์งœ ๊ฐ’์„ ๊ฐ€์ ธ์™€์„œ '2์›” 10์ผ'๋กœ ํ‘œ๊ธฐํ•ด์ฃผ๊ธฐ ์œ„ํ•ด javascript์˜ moment().format()์„ ์ผ๋Š”๋ฐ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฝ๊ณ  ๋ฌธ๊ตฌ๊ฐ€ ์ž๊พธ ๋–ด๋‹ค. ํ˜•์‹์ด ๋ณ€ํ™˜๋˜๋Š” ๋ฐ๋Š” ๋ฌธ์ œ๊ฐ€ ์—†์ง€๋งŒ, ๊ธด ๊ฒฝ๊ณ ์ฐฝ์ด ์ž๊พธ ๋œจ๋Š” ๊ฒƒ์ด ๊ฑฐ์Šฌ๋ ค ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์ฐพ์•„๋ณด์•˜๋‹ค.

 

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format ...

 

์ด์œ ๋Š”  2021-02-15T15:00:00.000Z ์™€ ๊ฐ™์€ ํ˜•์‹์œผ๋กœ ๋งž์ถฐ์ค˜์•ผ moment์—์„œ format์„ ์ž˜ ๋ณ€ํ™˜ํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

 

๊ทธ๋ž˜์„œ ํ˜•์‹์„ ๋ณ€ํ™˜ํ•ด์ฃผ๊ธฐ ์ „์— ์•„๋ž˜ ์ฝ”๋“œ๋ฅผ ํ•œ ์ค„๋งŒ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ๊ฒฝ๊ณ ์ฐฝ์ด ๋œจ์ง€ ์•Š๋Š”๋‹ค.

let date = new Date('2021.02.16');
date = moment(date).format('MM์›” DD์ผ');

๊ฐ„๋‹จํ•˜๊ฒŒ ํ•ด๊ฒฐโ—๏ธ๐Ÿฅณ