Skip to content

Commit

Permalink
docs: Update .diff doc (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkun authored Jun 18, 2019
1 parent f0f43d2 commit 96c47fb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions docs/en/API-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The `Dayjs` object is immutable, that is, all API operations that change the `Da
- [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)
- [Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`](#difference-diffcompared-dayjs-unit-string-float-boolean)
- [Unix Timestamp (milliseconds) `.valueOf()`](#unix-timestamp-milliseconds-valueof)
- [Unix Timestamp (seconds) `.unix()`](#unix-timestamp-seconds-unix)
- [UTC offset (minutes) `.utcOffset()`](#utc-offset-minutes-utcoffset)
Expand Down Expand Up @@ -310,14 +310,14 @@ dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'
- More available formats `Q Do k kk X x ...` in plugin [`AdvancedFormat`](./Plugin.md#advancedformat)
- Localized format options `L LT LTS ...` in plugin [`LocalizedFormat`](./Plugin.md#localizedFormat)

### Difference `.diff(compared: Dayjs, unit: string (default: 'milliseconds'), float?: boolean)`
### Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`

Returns a `number` indicating the difference of two `Dayjs`s in the specified unit.

```js
const date1 = dayjs('2019-01-25')
const date2 = dayjs('2018-06-05')
date1.diff(date2) // 20214000000
date1.diff(date2) // 20214000000 default milliseconds
date1.diff(date2, 'month') // 7
date1.diff(date2, 'month', true) // 7.645161290322581
date1.diff(date2, 'day') // 233
Expand Down
6 changes: 3 additions & 3 deletions docs/es-es/API-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ El objeto `Dayjs` es inmutable, por lo que toda operación de la API que altere
- [Presentación](#presentación)
- [Dar formato `.format(stringWithTokens: string)`](#dar-formato-formatstringwithtokens-string)
- [Lista de formatos disponibles](#lista-de-formatos-disponibles)
- [Diferencia `.diff(compared: Dayjs, unit: string (predeterminada: 'milliseconds'), float?: boolean)`](#diferencia-diffcompared-dayjs-unit-string-predeterminada-milliseconds-float-boolean)
- [Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`](#difference-diffcompared-dayjs-unit-string-float-boolean)
- [Tiempo Unix (milisegundos) `.valueOf()`](#tiempo-unix-milisegundos-valueof)
- [Tiempo Unix (segundos) `.unix()`](#tiempo-unix-segundos-unix)
- [UTC offset (minutos) `.utcOffset()`](#utc-offset-minutos-utcoffset)
Expand Down Expand Up @@ -310,14 +310,14 @@ dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'
- Más formatos disponibles `Q Do k kk X x ...` con el complemento [`AdvancedFormat`](./Plugin.md#advancedformat)
- Localized format options `L LT LTS ...` in plugin [`LocalizedFormat`](./Plugin.md#localizedFormat)

### Diferencia `.diff(compared: Dayjs, unit: string (predeterminada: 'milliseconds'), float?: boolean)`
### Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`

Devuelve un dato de tipo `number`, que indica la diferencia existente entre dos objetos `Dayjs`, expresada en la unidad de tiempo dada.

```js
const date1 = dayjs('2019-01-25')
const date2 = dayjs('2018-06-05')
date1.diff(date2) // 20214000000
date1.diff(date2) // 20214000000 default milliseconds
date1.diff(date2, 'month') // 7
date1.diff(date2, 'month', true) // 7.645161290322581
date1.diff(date2, 'day') // 233
Expand Down
6 changes: 3 additions & 3 deletions docs/ja/API-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Day.js は組み込みの `Date.prototype` を変更する代わりに `Dayjs`
- [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)
- [Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`](#difference-diffcompared-dayjs-unit-string-float-boolean)
- [Unix Timestamp (milliseconds) `.valueOf()`](#unix-timestamp-milliseconds-valueof)
- [Unix Timestamp (seconds) `.unix()`](#unix-timestamp-seconds-unix)
- [UTC Offset (minutes) `.utcOffset()`](#utc-offset-minutes-utcoffset)
Expand Down Expand Up @@ -310,14 +310,14 @@ dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'
- 利用可能な他のフォーマット `Q Do k kk X x ...` in plugin [`AdvancedFormat`](./Plugin.md#advancedformat)
- ローカライズのフォーマットオプション `L LT LTS ...` in plugin [`LocalizedFormat`](./Plugin.md#localizedFormat)

### Difference `.diff(compared: Dayjs, unit: string (default: 'milliseconds'), float?: boolean)`
### Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`

2 つの`Dayjs`オブジェクトの差分を指定した単位で数値で返します。

```js
const date1 = dayjs('2019-01-25')
const date2 = dayjs('2018-06-05')
date1.diff(date2) // 20214000000
date1.diff(date2) // 20214000000 default milliseconds
date1.diff(date2, 'month') // 7
date1.diff(date2, 'month', true) // 7.645161290322581
date1.diff(date2, 'day') // 233
Expand Down
6 changes: 3 additions & 3 deletions docs/ko/API-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Day.js는 네이티브 `Date.prototype`을 수정하는 대신 `Dayjs` 오브젝
- [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)
- [Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`](#difference-diffcompared-dayjs-unit-string-float-boolean)
- [Unix Timestamp (milliseconds) `.valueOf()`](#unix-timestamp-milliseconds-valueof)
- [Unix Timestamp (seconds) `.unix()`](#unix-timestamp-seconds-unix)
- [UTC offset (minutes) `.utcOffset()`](#utc-offset-minutes-utcoffset)
Expand Down Expand Up @@ -309,14 +309,14 @@ dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'
- 플러그인 [`AdvancedFormat`](./Plugin.md#advancedformat) 을 사용하면 더 많은 형식(`Q Do k kk X x ...`)을 사용할 수 있습니다.
- Localized format options `L LT LTS ...` in plugin [`LocalizedFormat`](./Plugin.md#localizedFormat)

### Difference `.diff(compared: Dayjs, unit: string (default: 'milliseconds'), float?: boolean)`
### Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`

`Dayjs` 오브젝트 차이를 지정한 단위로 가져옵니다. 반환 타입은 `number` 입니다.

```js
const date1 = dayjs('2019-01-25')
const date2 = dayjs('2018-06-05')
date1.diff(date2) // 20214000000
date1.diff(date2) // 20214000000 default milliseconds
date1.diff(date2, 'month') // 7
date1.diff(date2, 'month', true) // 7.645161290322581
date1.diff(date2, 'day') // 233
Expand Down
6 changes: 3 additions & 3 deletions docs/pt-br/API-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ O objeto `Dayjs` é imutável, ou seja, todas as operações da API que alteram
- [Exibindo](#exibindo)
- [Formatação `.format(stringWithTokens: string)`](#formatação-formatstringwithtokens-string)
- [Lista com todos os formatos disponíveis](#lista-com-todos-os-formatos-disponíveis)
- [Diferença `.diff(compared: Dayjs, unit: string (padrão: 'milliseconds'), float?: boolean)`](#diferença-diffcompared-dayjs-unit-string-padrão-milliseconds-float-boolean)
- [Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`](#difference-diffcompared-dayjs-unit-string-float-boolean)
- [Unix Timestamp (milissegundos) `.valueOf()`](#unix-timestamp-milissegundos-valueof)
- [Unix Timestamp (segundos) `.unix()`](#unix-timestamp-segundos-unix)
- [UTC offset (minutes) `.utcOffset()`](#utc-offset-minutes-utcoffset)
Expand Down Expand Up @@ -308,14 +308,14 @@ dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'
- Mais formatos disponíveis `Q Do k kk X x ...` no plugin [`AdvancedFormat`](./Plugin.md#advancedformat)
- Localized format options `L LT LTS ...` in plugin [`LocalizedFormat`](./Plugin.md#localizedFormat)

### Diferença `.diff(compared: Dayjs, unit: string (padrão: 'milliseconds'), float?: boolean)`
### Difference `.diff(compared: Dayjs, unit?: string, float?: boolean)`

Retorna um `number` indicando a diferença entre dois objetos `Dayjs` na unidade especificada.

```js
const date1 = dayjs('2019-01-25')
const date2 = dayjs('2018-06-05')
date1.diff(date2) // 20214000000
date1.diff(date2) // 20214000000 default milliseconds
date1.diff(date2, 'month') // 7
date1.diff(date2, 'month', true) // 7.645161290322581
date1.diff(date2, 'day') // 233
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn/API-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ dayjs().format('{YYYY} MM-DDTHH:mm:ssZ[Z]') // "{2014} 09-08T08:02:17-05:00Z"
```js
const date1 = dayjs('2019-01-25')
const date2 = dayjs('2018-06-05')
date1.diff(date2) // 20214000000
date1.diff(date2) // 20214000000
date1.diff(date2, 'month') // 7
date1.diff(date2, 'month', true) // 7.645161290322581
date1.diff(date2, 'day') // 233
Expand Down

0 comments on commit 96c47fb

Please sign in to comment.