
[Node.js] 자바스크립트에서 날짜 format 쉽게 지정하기 [Day.js로 날짜 간편하게 다루기]
·
◎ JavaScript/Node.js🫒
- 자바스크립트에서 날짜 format 쉽게 지정하기npm install dayjsconst dayjs = require('dayjs');// 오늘 날짜console.log(dayjs().format('YYYY-MM-DD')); // 2025-04-18// 날짜 덧셈console.log(dayjs().add(7, 'day').format('YYYY-MM-DD')); // 7일 후// 날짜 비교console.log(dayjs('2025-01-01').isBefore('2025-04-01')); // true// 불변성 확인const a = dayjs();const b = a.add(1, 'day');console.log(a.format('YYYY-MM-DD')); // 변경 없음console.log(b.fo..