MomentJS-기간
MomentJS는 주어진 단위에 대한 시간을 처리하는 기간이라는 중요한 기능을 제공합니다. 이 장에서는 이에 대해 자세히 알아 봅니다.
기간과 함께 사용 가능한 방법
다음 표는 모멘트 지속 시간과 함께 사용되는 다른 단위에 대해 지속 시간으로 사용 가능한 방법을 보여줍니다
| 방법 | 통사론 | 
|---|---|
| 생성 | moment.duration (숫자, 문자열); moment.duration (숫자); moment.duration (객체); moment.duration (문자열); | 
| 복제 | moment.duration (). clone (); | 
| 인간화 | moment.duration (). humanize (); | 
| 밀리 초 | moment.duration (). milliseconds (); moment.duration (). asMilliseconds (); | 
| 초 | moment.duration (). seconds (); moment.duration (). asSeconds (); | 
| 의사록 | moment.duration (). minutes (); moment.duration (). asMinutes (); | 
| 시간 | moment.duration (). hours (); moment.duration (). asHours (); | 
| 일 | moment.duration (). days (); moment.duration (). asDays (); | 
| 주 | moment.duration (). weeks (); moment.duration (). asWeeks (); | 
| 개월 | moment.duration (). months (); moment.duration (). asMonths (); | 
| Years | moment.duration (). years (); moment.duration (). asYears (); | 
| 시간 추가 | moment.duration (). add (Number, String); moment.duration (). add (번호); moment.duration (). add (Duration); moment.duration (). add (Object); | 
| 시간 빼기 | moment.duration (). subtract (Number, String); moment.duration (). subtract (Number); moment.duration (). subtract (Duration); moment.duration (). subtract (Object); | 
| Diff와 함께 Duration 사용 | var duration = moment.duration (x.diff (y)) | 
| 시간 단위로 | moment.duration (). as (문자열); | 
| 시간 단위 가져 오기 | duration.get ( '시간'); duration.get ( '분'); duration.get ( '초'); duration.get ( '밀리 초'); | 
| JSON으로 | moment.duration (). toJSON (); | 
| 기간 | moment.isDuration (obj); | 
| ISO 8601 문자열로 | moment.duration (). toISOString (); | 
| 장소 | moment.duration (). locale (); moment.duration (). locale (String); |