Day.js는 Moment.js 호환 API를 사용하여 최신 브라우저의 날짜 및 시간을 구문 분석, 유효성 검사, 조작 및 표시하는 미니멀리즘 JavaScript 라이브러리입니다.
https://github.com/iamkun/dayjs
Day.js는 Moment.js와 호환되는 대부분의 API를 사용하며, 최신 브라우저에서 날짜와 시간에 대한 구문 분석, 유효성 검사, 조작, 출력하는 경량 JavaScript 라이브러리입니다. Moment.js를 사용하고 있다면, Day.js는 껌입니다.
dayjs() .startOf('month') .add(1, 'day') .set('year', 2018) .format('YYYY-MM-DD HH:mm:ss')
API
Day.js API를 사용해서 날짜와 시간에 대한 구문 분석, 유효성 검사, 조작, 출력을 쉽게 할 수 있습니다.
dayjs('2018-08-08') // parse dayjs().format('{YYYY} MM-DDTHH:mm:ss SSS [Z] A') // display dayjs() .set('month', 3) .month() // get & set dayjs().add(1, 'year') // manipulate dayjs().isBefore(dayjs()) // query
I18n
Day.js는 국제화에 대해 많은 지원을 합니다.
그러나 그것을 사용하지 않는다면, 그 누구도 당신의 빌드에 포함되지 않습니다.
import 'dayjs/locale/es' // load on demand dayjs.locale('es') // use Spanish locale globally dayjs('2018-05-05') .locale('zh-cn') .format() // use Chinese Simplified locale in a specific instance
Installation Guide
Day.js를 가져오는 방법은 여러가지가 있습니다:
NPM:
npm install dayjs --save
import dayjs from 'dayjs' // Or CommonJS // var dayjs = require('dayjs'); dayjs().format()
CDN:
<!-- Latest compiled and minified JavaScript --> <script src="https://unpkg.com/dayjs"></script> <script> dayjs().format() </script>
다운 받아 셀프 호스팅:
https://unpkg.com/dayjs/에서 Day.js 의 최신 버전을 받을 수 있습니다.
등록된 댓글이 없습니다.