From 600e81d79179b767304be6c97a070feecde11296 Mon Sep 17 00:00:00 2001 From: Sungjin Kang Date: Tue, 29 May 2018 23:21:11 +0900 Subject: [PATCH] Add Korean locale Korean locale!! #171 --- docs/ko/API-reference.md | 394 +++++++++++++++++++++++++++++++++++++++ docs/ko/I18n.md | 110 +++++++++++ docs/ko/Installation.md | 30 +++ docs/ko/Plugin.md | 143 ++++++++++++++ docs/ko/README-ko.md | 99 ++++++++++ src/locale/ko.js | 27 +++ 6 files changed, 803 insertions(+) create mode 100644 docs/ko/API-reference.md create mode 100644 docs/ko/I18n.md create mode 100644 docs/ko/Installation.md create mode 100644 docs/ko/Plugin.md create mode 100644 docs/ko/README-ko.md create mode 100644 src/locale/ko.js diff --git a/docs/ko/API-reference.md b/docs/ko/API-reference.md new file mode 100644 index 000000000..aee5fd574 --- /dev/null +++ b/docs/ko/API-reference.md @@ -0,0 +1,394 @@ +## API Reference + +Day.js는 네이티브 `Date.prototype`을 수정하는 대신 `Dayjs` 오브젝트인 Date 오브젝트 래퍼를 생성합니다. + +`Dayjs` 오브젝트는 변경이 불가능(immutable)합니다. 즉, 모든 API 작업은 새로운 `Dayjs` 객체를 반환해야 합니다. + +- [API Reference](#api-reference) + - [Parsing](#parsing) + - [Constructor `dayjs(existing?: string | number | Date | Dayjs)`](#constructor-dayjsexisting-string--number--date--dayjs) + - [ISO 8601 string](#iso-8601-string) + - [Unix Timestamp (milliseconds since the Unix Epoch - Jan 1 1970, 12AM UTC)](#unix-timestamp-milliseconds-since-the-unix-epoch---jan-1-1970-12am-utc) + - [Native Javascript Date object](#native-javascript-date-object) + - [Clone `.clone() | dayjs(original: Dayjs)`](#clone-clone-dayjsoriginal-dayjs) + - [Validation `.isValid()`](#validation-isvalid) + - [Get and Set](#get-and-set) + - [Year `.year()`](#year-year) + - [Month `.month()`](#month-month) + - [Day of the Month `.date()`](#day-of-the-month-date) + - [Day of the Week `.day()`](#day-of-the-week-day) + - [Hour `.hour()`](#hour-hour) + - [Minute `.minute()`](#minute-minute) + - [Second `.second()`](#second-second) + - [Millisecond `.millisecond()`](#millisecond-millisecond) + - [Set `.set(unit: string, value: number)`](#set-setunit-string-value-number) + - [Manipulating](#manipulating) + - [Add `.add(value: number, unit: string)`](#add-addvalue-number-unit-string) + - [Subtract `.subtract(value: number, unit: string)`](#subtract-subtractvalue-number-unit-string) + - [Start of Time `.startOf(unit: string)`](#start-of-time-startofunit-string) + - [End of Time `.endOf(unit: string)`](#end-of-time-endofunit-string) + - [Displaying](#displaying) + - [Format `.format(stringWithTokens: string)`](#format-formatstringwithtokens-string) + - [List of all available formats](#list-of-all-available-formats) + - [Difference `.diff(compared: Dayjs, unit: string (default: 'milliseconds'), float?: boolean)`](#difference-diffcompared-dayjs-unit-string-default-milliseconds-float-boolean) + - [Unix Timestamp (milliseconds) `.valueOf()`](#unix-timestamp-milliseconds-valueof) + - [Unix Timestamp (seconds) `.unix()`](#unix-timestamp-seconds-unix) + - [Days in the Month `.daysInMonth()`](#days-in-the-month-daysinmonth) + - [As Javascript Date `.toDate()`](#as-javascript-date-todate) + - [As Array `.toArray()`](#as-array-toarray) + - [As JSON `.toJSON()`](#as-json-tojson) + - [As ISO 8601 String `.toISOString()`](#as-iso-8601-string-toisostring) + - [As Object `.toObject()`](#as-object-toobject) + - [As String `.toString()`](#as-string-tostring) + - [Query](#query) + - [Is Before `.isBefore(compared: Dayjs)`](#is-before-isbeforecompared-dayjs) + - [Is Same `.isSame(compared: Dayjs)`](#is-same-issamecompared-dayjs) + - [Is After `.isAfter(compared: Dayjs)`](#is-after-isaftercompared-dayjs) + - [Is Leap Year `.isLeapYear()`](#is-leap-year-isleapyear) + - [Plugin APIs](#plugin-apis) + - [RelativeTime](#relativetime) + +## Parsing + +### Constructor `dayjs(existing?: string | number | Date | Dayjs)` + +매개 변수없이 호출하면 현재 날짜와 시간을 가진 새로운 `Dayjs` 오브젝트가 반환됩니다. + +```js +dayjs(); +``` + +Day.js는 다른 날짜 형식도 구분 분석합니다. + +#### [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) string + +```js +dayjs('2018-04-04T16:00:00.000Z'); +``` + +#### Unix Timestamp (milliseconds since the Unix Epoch - Jan 1 1970, 12AM UTC) + +```js +dayjs(1318781876406); +``` + +#### Native Javascript Date object + +```js +dayjs(new Date(2018, 8, 18)); +``` + +### Clone `.clone() | dayjs(original: Dayjs)` + +`Dayjs` 클론을 반환합니다. + +```js +dayjs().clone(); +dayjs(dayjs('2019-01-25')); // passing a Dayjs object to a constructor will also clone it +``` + +### Validation `.isValid()` + +`Dayjs` 날짜가 유효한지 확인하도록 `boolean` 값으로 반환합니다. + +```js +dayjs().isValid(); +``` + +## Get and Set + +### Year `.year()` + +`Dayjs`에서 연도를 `number` 타입 값으로 반환합니다. + +```js +dayjs().year(); +``` + +### Month `.month()` + +`Dayjs`에서 달을 `number` 타입 값으로 반환합니다. + +```js +dayjs().month(); +``` + +### Day of the Month `.date()` + +`Dayjs`에서 일자를 `number` 타입 값으로 반환합니다. + +```js +dayjs().date(); +``` + +### Day of the Week `.day()` + +`Dayjs`에서 주에 대한 일자를 `number` 타입 값으로 반환합니다. + +```js +dayjs().day(); +``` + +### Hour `.hour()` + +`Dayjs`에서 시를 `number` 타입 값으로 반환합니다. + +```js +dayjs().hour(); +``` + +### Minute `.minute()` + +`Dayjs`에서 분을 `number` 타입 값으로 반환합니다. + +```js +dayjs().minute(); +``` + +### Second `.second()` + +`Dayjs`에서 초를 `number` 타입 값으로 반환합니다. + +```js +dayjs().second(); +``` + +### Millisecond `.millisecond()` + +`Dayjs`에서 밀리초를 `number` 타입 값으로 반환합니다. + +```js +dayjs().millisecond(); +``` + +### Set `.set(unit: string, value: number)` + +적용된 번경사항이 있는 `Dayjs`를 반환합니다. + +```js +dayjs('2000-10-25') + .set('month', 3) + .set('year', 2020).toString(); // Sat, 25 Apr 2020 00:00:00 GMT +``` + +## Manipulating + +`Dayjs` 오브젝트는 여러 방법으로 처리할 수 있습니다. + +```js +dayjs('2019-01-25') + .add(1, 'day') + .subtract(1, 'year').toString(); // Fri, 26 Jan 2018 00:00:00 GMT +``` + +### Add `.add(value: number, unit: string)` + +특정 시간이 추가하여 복제된 `Dayjs`를 반환합니다. + +```js +dayjs().add(7, 'day'); +``` + +### Subtract `.subtract(value: number, unit: string)` + +특정 시간이 감소하여 복제된 `Dayjs`를 반환합니다. + +```js +dayjs().subtract(7, 'year'); +``` + +### Start of Time `.startOf(unit: string)` + +특정 시간 단위의 시작 시점에 대한 시간을 복제된 `Dayjs`로 반환합니다. + +```js +dayjs().startOf('week'); +``` + +### End of Time `.endOf(unit: string)` + +특정 시간 단위의 끝나는 시점에 대한 시간을 복제된 `Dayjs`로 반환힙니다. + +```js +dayjs().endOf('month'); +``` + +## Displaying + +### Format `.format(stringWithTokens: string)` + +`Dayjs`시간을 기본 형식으로 `string` 타입 값으로 반환합니다. +예외하고 싶은 문자일 경우, 대괄호나 중괄호를 사용하여 묶으면됩니다. (예, `[G] {um}`) + +```js +dayjs().format(); // 분과 초가 없는 ISO5801 형식의 현재 시간을 나타냅니다. 예: '2020-04-02T08:02:17-05:00' + +dayjs('2019-01-25').format('{YYYY} MM-DDTHH:mm:ssZ[Z]'); // '{2019} 01-25T00:00:00-02:00Z' + +dayjs('2019-01-25').format('DD/MM/YYYY'); // '25/01/2019' +``` + +#### 사용 가능한 모든 형식 목록 + +| Format | Output | Description | +| ------ | ---------------- | ------------------------------------- | +| `YY` | 18 | 두 자리로 된 연도 | +| `YYYY` | 2018 | 네 자리로 된 연도 | +| `M` | 1-12 | 달, 1부터 시작 | +| `MM` | 01-12 | 달, 두 자리로 표현 | +| `MMM` | Jan-Dec | 월 이름 약어 | +| `MMMM` | January-December | 월 이름 | +| `D` | 1-31 | 일 | +| `DD` | 01-31 | 일, 두 자리로 표현 | +| `d` | 0-6 | 요일, 일요일은 0 | +| `dddd` | Sunday-Saturday | 요일 이름 | +| `H` | 0-23 | 시간 | +| `HH` | 00-23 | 시간, 두 자리로 표현 | +| `h` | 1-12 | 시간, 12시간 | +| `hh` | 01-12 | 시간, 12시간, 두 자리로 표현 | +| `m` | 0-59 | 분 | +| `mm` | 00-59 | 분, 두 자리로 표현 | +| `s` | 0-59 | 초 | +| `ss` | 00-59 | 초, 두 자리로 표현 | +| `SSS` | 000-999 | 밀리 초, 3자리로 표현 | +| `Z` | +5:00 | UTC로부터 추가된 시간 | +| `ZZ` | +0500 | UTC로부터 추가된 시간, 두자리로 표현 | +| `A` | AM PM | | +| `a` | am pm | | + +* 플러그인 [`AdvancedFormat`](./Plugin.md#advancedformat) 을 사용하면 더 많은 형식 (`Q Do k kk X x ...`)을 사용할 수 있습니다. + +### Difference `.diff(compared: Dayjs, unit: string (default: 'milliseconds'), float?: boolean)` + +특정 시간을 가르키는 두 `Dayjs`에 대한 차이를 `number` 타입 값으로 반환합니다. + +```js +const date1 = dayjs('2019-01-25'); +const date2 = dayjs('2018-06-05'); +date1.diff(date2); // 20214000000 +date1.diff(date2, 'months'); // 7 +date1.diff(date2, 'months', true); // 7.645161290322581 +date1.diff(date2, 'days'); // 233 +``` + +### Unix Timestamp (milliseconds) `.valueOf()` + +`Dayjs`에 대한 Unix Epoch 이후의 밀리 초 시간을 `number` 타입 값으로 반환합니다. + +```js +dayjs('2019-01-25').valueOf(); // 1548381600000 +``` + +### Unix Timestamp (seconds) `.unix()` + +`Dayjs`에 대한 Unix Epoch 이후의 초 시간을 `number` 타입 값으로 반환합니다. + +```js +dayjs('2019-01-25').unix(); // 1548381600 +``` + +### Days in the Month `.daysInMonth()` + +`Dayjs`에서 표기하는 달에서 일수를 `number` 타입 값으로 반환합니다. + +```js +dayjs('2019-01-25').daysInMonth(); // 31 +``` + +### As Javascript Date `.toDate()` + +`Dayjs` 오브젝트에서 파싱된 네이티브 `Date` 겍체 복사본을 반환합니다. + +```js +dayjs('2019-01-25').toDate(); +``` + +### As Array `.toArray()` + +새로운 `Date()`로부터 매개변수를 반영하는 날짜를 `array` 타입 값으로 반환합니다. + +```js +dayjs('2019-01-25').toArray(); // [ 2019, 0, 25, 0, 0, 0, 0 ] +``` + +### As JSON `.toJSON()` + +ISO8601 `string` 타입 형식으로 `Dayjs`를 반환합니다. + +```js +dayjs('2019-01-25').toJSON(); // '2019-01-25T02:00:00.000Z' +``` + +### As ISO 8601 String `.toISOString()` + + +ISO8601 `string` 타입 형식으로 `Dayjs`를 반환합니다. + +```js +dayjs('2019-01-25').toISOString(); // '2019-01-25T02:00:00.000Z' +``` + +### As Object `.toObject()` + +날짜 속성을 가진 `object` 타입 값으로 반환합니다. + +```js +dayjs('2019-01-25').toObject(); +/* { years: 2019, + months: 0, + date: 25, + hours: 0, + minutes: 0, + seconds: 0, + milliseconds: 0 } */ +``` + +### As String `.toString()` + +날짜를 `string` 타입 값으로 반환합니다. + +```js +dayjs('2019-01-25').toString(); // 'Fri, 25 Jan 2019 02:00:00 GMT' +``` + +## Query + +### Is Before `.isBefore(compared: Dayjs)` + +`Dayjs` 값이 다른 `Dayjs` 값보다 앞선 시점인지를 `boolean` 타입 값으로 반환합니다. + +```js +dayjs().isBefore(dayjs()); // false +``` + +### Is Same `.isSame(compared: Dayjs)` + +`Dayjs` 값이 다른 `Dayjs` 값과 동일한 시점인지를 `boolean` 타입 값으로 반환합니다. + +```js +dayjs().isSame(dayjs()); // true +``` + +### Is After `.isAfter(compared: Dayjs)` + +`Dayjs` 값이 다른 `Dayjs` 값과 뒷선 시점인지를 `boolean` 타입 값으로 반환합니다. + +```js +dayjs().isAfter(dayjs()); // false +``` + +### Is Leap Year `.isLeapYear()` + +`Dayjs` 값이 윤년인지를 `boolean` 타입 값으로 반환합니다. + +```js +dayjs('2000-01-01').isLeapYear(); // true +``` + +## Plugin APIs + +### RelativeTime + +`.from` `.to` `.fromNow` `.toNow`에 대한 상대 시간을 가져옵니다. + +플러그인 [`RelativeTime`](./Plugin.md#relativetime) diff --git a/docs/ko/I18n.md b/docs/ko/I18n.md new file mode 100644 index 000000000..9b682a70d --- /dev/null +++ b/docs/ko/I18n.md @@ -0,0 +1,110 @@ +## Internationalization + +Day.js는 국제화에 대해 많은 지원을 합니다. + +그러나 그것을 사용하지 않는다면, 그 누구도 당신의 빌드에 포함되지 않습니다. + +Day.js에서 기본 locale 값은 영어 (미국) 입니다. + +여러 locale을 로드하고 싶다면 쉽게 locale간 전환 할 수 있습니다. + +[지원하는 locale 목록](../../src/locale) + +풀 리퀘스트를 열어 당신의 locale을 추가할 수 있습니다. :+1: + +## API + +#### Changing locale globally + +* locale 문자열로 반환합니다. + +```js +import 'dayjs/locale/es' +import de from 'dayjs/locale/de' +dayjs.locale('es') // 글로벌 하게 locale을 로드하여 사용합니다. +dayjs.locale('de-german', de) // locale 사용 및 기본 이름 문자열 업데이트 +const customizedLocaleObject = { ... } // 자세한 내용은 아래 커스텀 설정 섹션을 참조하세요. +dayjs.locale(customizedLocaleObject) // 커스텀 locale 사용 +``` + +* 글로벌 locale을 변경해도 기존 인스턴스에는 영향을 주지 않습니다. + +#### Changing locales locally + +* 새로운 locale로 전환하여 새로운 'Dayjs' 오브젝트를 반환합니다. + +정확히 `dayjs#locale`과 동일하지만, 특정 인스턴스에서만 locale을 사용합니다. + +```js +import 'dayjs/locale/es' +dayjs().locale('es').format() // 국지적으로 locale을 로드하여 사용합니다.. +dayjs('2018-4-28', { locale: es }) // through constructor +``` + +## Installation + +* NPM: + +```javascript +import 'dayjs/locale/es' // load on demand +// require('dayjs/locale/es') // CommonJS +// import locale_es from 'dayjs/locale/es' -> load and get locale_es locale object + +dayjs.locale('es') // 글로벌 하게 사용 +dayjs().locale('es').format() // 특정 인스턴스에서 사용. +``` + +* CDN: +```html + + + + +``` + +## Customize + +당신만의 locale을 만들 수 있습니다. + +locale을 공휴하기위해 풀 리퀘스트를 여십시오. + +Day.js locale 오브젝트 템플릿 입니다. +```javascript +const localeObject = { + name: 'es', // name String + weekdays: 'Domingo_Lunes ...'.split('_'), // weekdays Array + months: 'Enero_Febrero ... '.split('_'), // months Array + ordinal: n => `${n}º`, // ordinal Function (number) => return number + output + relativeTime = { // relative time format strings, keep %s %d as the same + future: 'in %s', // e.g. in 2 hours, %s been replaced with 2hours + past: '%s ago', + s: 'a few seconds', + m: 'a minute', + mm: '%d minutes', + h: 'an hour', + hh: '%d hours', // e.g. 2 hours, %d been replaced with 2 + d: 'a day', + dd: '%d days', + M: 'a month', + MM: '%d months', + y: 'a year', + yy: '%d years' + } +} +``` + +Day.js locale 파일 템플릿 입니다. +```javascript +import dayjs from 'dayjs' + +const locale = { ... } // Your Day.js locale Object. + +dayjs.locale(locale, null, true) // load locale for later use + +export default locale +``` diff --git a/docs/ko/Installation.md b/docs/ko/Installation.md new file mode 100644 index 000000000..b18630411 --- /dev/null +++ b/docs/ko/Installation.md @@ -0,0 +1,30 @@ +## Installation Guide + +Day.js를 가져오는 방법은 여러가지가 있습니다: + +* NPM: + +```console +npm install dayjs --save +``` + +```js +import dayjs from 'dayjs' +// Or CommonJS +// var dayjs = require('dayjs'); +dayjs().format(); +``` + +* CDN: + +```html + + + +``` + +* 다운 받아 셀프 호스팅: + +[https://unpkg.com/dayjs/](https://unpkg.com/dayjs/)에서 Day.js 의 최신버전을 받을 수 있습니다. diff --git a/docs/ko/Plugin.md b/docs/ko/Plugin.md new file mode 100644 index 000000000..4d40f7644 --- /dev/null +++ b/docs/ko/Plugin.md @@ -0,0 +1,143 @@ +# Plugin List + +플러그인은 기능을 확장하거나 새로운 기능을 추가하기 위해 Day.js에 추가할 수 있는 독립적인 모듈입니다. + +기본적으로 Day.js에는 코어 코드만 있고 플러그인이 설치되어있지 않습니다. + +필요에 따라 여러개의 플러그인을 로드할 수 있습니다. + +## API + +#### Extend + +* dayjs를 반환합니다. + +플러그인을 사용합니다. + +```js +import plugin +dayjs.extend(plugin) +dayjs.extend(plugin, options) // with plugin options +``` + +## Installation + +* NPM: + +```javascript +import dayjs from 'dayjs' +import AdvancedFormat from 'dayjs/plugin/AdvancedFormat' // load on demand + +dayjs.extend(AdvancedFormat) // use plugin +``` + +* CDN: +```html + + + + +``` + +## List of official plugins + +### AdvancedFormat + - AdvancedFormat은 더 많은 형식 옵션을 제공하기위해 `dayjs().format` API를 확장합니다. + +```javascript +import advancedFormat from 'dayjs/plugin/advancedFormat' + +dayjs.extend(advancedFormat) + +dayjs().format('Q Do k kk X x') +``` + +추가된 형식 목록: + +| Format | Output | Description | +| ------ | ---------------- | ------------------------------------- | +| `Q` | 1-4 | 분기 | +| `Do` | 1st 2nd ... 31st | 서수형식의 일자 명 | +| `k` | 1-23 | 시간, 1부터 시작 | +| `kk` | 01-23 | 시간, 2자리 표현, 1부터 시작 | +| `X` | 1360013296 | 유닉스 타임스템프, 초 | +| `x` | 1360013296123 | 유닉스 타임스탬프, 밀리 초 | + +### RelativeTime + - RelativeTime은 `.from`, `.to`, `.fromNow`, `.toNow` API를 추가하여 날짜를 상대 시간 문자열(에: 3 시간전) 으로 표시합니다. + +```javascript +import relativeTime from 'dayjs/plugin/relativeTime' + +dayjs.extend(relativeTime) + +dayjs().from(dayjs('1990')) // 2 years ago +dayjs().from(dayjs(), true) // 2 years + +dayjs().fromNow() + +dayjs().to(dayjs()) + +dayjs().toNow() +``` + +#### Time from now `.fromNow(withoutSuffix?: boolean)` + +지금 시간부터 상대시간을 `string`으로 반환합니다. + +#### Time from X `.from(compared: Dayjs, withoutSuffix?: boolean)` + +X 시간으로부터 상대시간을 `string`으로 반환합니다.. + +#### Time to now `.toNow(withoutSuffix?: boolean)` + +지금 시간부터 상대시간을 `string`으로 반환합니다. + +#### Time to X `.to(compared: Dayjs, withoutSuffix?: boolean)` + +X 시간부터 상대시간을 `string`으로 반환합니다. + +| 범위 | Key | 간단 출력 | +| ----------------- | ---- | --------------------- | +| 0 초 ~ 44 초 | s | 몇 초 전 | +| 45 초 ~ 89 초 | m | 1 분 전 | +| 90 초 ~ 44 분 | mm | 2 분 전 ~ 44 분 전 | +| 45 분 ~ 89 분 | h | 한 시간 전 | +| 90 분 ~ 21 시간 | hh | 2 시간 전 ~ 21 시간 전 | +| 22 시간 ~ 35 시간 | d | 하루 전 | +| 36 시간 ~ 25 일 | dd | 이틀 전 ~ 25 일 전 | +| 26 일 ~ 45 일 | M | 한달 전 | +| 46 일 ~ 10 달 | MM | 두달 전 ~ 10 달 전 | +| 11 달 ~ 17 달 | y | 일년 전 | +| 18 달 이상 | yy | 2 년 전 ~ 20 년 전 | + + +## Customize + +다양한 요구를 충족하기위해 자신만의 Day.js 플러그인을 만들 수 있습니다. + +플러그인을 제작하고 풀 리퀘스트하여 공유하세요. + +Day.js 플러그인 템플릿 +```javascript +export default (option, dayjsClass, dayjsFactory) => { + // extend dayjs() + // e.g. add dayjs().isSameOrBefore() + dayjsClass.prototype.isSameOrBefore = function (arguments) {} + + // extend dayjs + // e.g. add dayjs.utc() + dayjsFactory.utc = (arguments) => {} + + // overriding existing API + // e.g. extend dayjs().format() + const oldFormat = dayjsClass.prototype.format + dayjsClass.prototype.format = function (arguments) { + // original format result + const result = oldFormat(arguments) + // return modified result + } +} +``` diff --git a/docs/ko/README-ko.md b/docs/ko/README-ko.md new file mode 100644 index 000000000..b0125131a --- /dev/null +++ b/docs/ko/README-ko.md @@ -0,0 +1,99 @@ +

Day.js

+

Moment.js와 호환되는 API를 가진 경량 라이브러리 (2kB)

+
+

+ Gzip Size + NPM Version + Build Status + Codecov + License +
+ + Sauce Test Status + +

+ +> Day.js는 Moment.js와 호환되는 대부분의 API를 사용하며, 최신 브라우저에서 날짜와 시간에 대한 구문 분석, 유효성 검사, 조작, 출력하는 경량 JavaScript 라이브러리입니다. Moment.js를 사용하고 있다면, Day.js는 껌입니다. + +```js +dayjs().startOf('month').add(1, 'day').set('year', 2018).format('YYYY-MM-DD HH:mm:ss'); +``` + +* 🕒 친숙한 Moment.js API와 패턴 +* 💪 불변 오브젝트(Immutable) +* 🔥 메소드 체인(Chainable) +* 🌐 I18n 지원 +* 📦 2kb 미니 라이브러리 +* 👫 모든 브라우저 지원 + +--- + +## 시작해볼까요! + +### 설치 + +```console +npm install dayjs --save +``` + +📚[설치 가이드](./Installation.md) + +### API + +Day.js API를 사용해서 날짜와 시간에 대한 구문 분석, 유효성 검사, 조작, 출력을 쉽게 할 수 있습니다. + +```javascript +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 +``` + +📚[API 참고](./API-reference.md) + +### I18n + +Day.js는 국제화에 대해 많은 지원을 합니다. + +그러나 그것을 사용하지 않는다면, 그 누구도 당신의 빌드에 포함되지 않습니다. + +```javascript +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 +``` + +📚[I18n](./docs/en/I18n.md) + +### Plugin + +플러그인은 기능을 확장하거나 새로운 기능을 추가하기 위해 Day.js에 추가할 수 있는 독립적인 모듈입니다. + +```javascript +import advancedFormat from 'dayjs/plugin/advancedFormat' // load on demand + +dayjs.extend(advancedFormat) // use plugin + +dayjs().format('Q Do k kk X x') // more available formats +``` + +📚[플러그인 목록](./Plugin.md) + +## License + +Day.js는 [MIT License](./LICENSE)를 사용합니다. diff --git a/src/locale/ko.js b/src/locale/ko.js new file mode 100644 index 000000000..0f5a75faa --- /dev/null +++ b/src/locale/ko.js @@ -0,0 +1,27 @@ +import dayjs from 'dayjs' + +const locale = { + name: 'ko', + weekdays: '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'), + months: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'), + ordinal: n => n, + relativeTime: { + future: '%s 아내', + past: '%s 전', + s: '몇 초', + m: '1 분', + mm: '%d 분', + h: '1 시간', + hh: '%d 시간', + d: '1 일', + dd: '%d 일', + M: '1 개월', + MM: '%d 개월', + y: '1 년', + yy: '%d 년' + } +} + +dayjs.locale(locale, null, true) + +export default locale