Skip to content

Commit

Permalink
Merge pull request #474 from iamkun/dev
Browse files Browse the repository at this point in the history
D2M
  • Loading branch information
iamkun committed Feb 4, 2019
2 parents 58a4d78 + e02ae82 commit 922b4e1
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/en/I18n.md
Expand Up @@ -25,6 +25,7 @@ dayjs.locale('es') // use loaded locale globally
dayjs.locale('de-german', de) // use locale and update default name string
const customizedLocaleObject = { ... } // More details can be found in Customize section below.
dayjs.locale(customizedLocaleObject) // use customize locale
dayjs.locale('en') // switch back to default English locale globally
```

* Changing the global locale doesn't affect existing instances.
Expand Down
1 change: 1 addition & 0 deletions docs/es-es/I18n.md
Expand Up @@ -28,6 +28,7 @@ dayjs.locale('de-german', de)
const customizedLocaleObject = { ... }
// uso de la configuración regional personalizada
dayjs.locale(customizedLocaleObject)
dayjs.locale('en') // switch back to default English locale globally
```

* Cambiar la configuración regional global no afecta a las instancias ya existentes.
Expand Down
1 change: 1 addition & 0 deletions docs/ja/I18n.md
Expand Up @@ -25,6 +25,7 @@ dayjs.locale('es') // 読み込んだロケールをグローバルに適用
dayjs.locale('de-german', de) // ロケールを使用し、デフォルトの名前文字列を更新
const customizedLocaleObject = { ... } // 詳細は、以下のカスタマイズの項を参照
dayjs.locale(customizedLocaleObject) // カスタムロケールを適用
dayjs.locale('en') // switch back to default English locale globally
```

* グローバルロケールを変更しても、既存のインスタンスには影響しません。
Expand Down
1 change: 1 addition & 0 deletions docs/ko/I18n.md
Expand Up @@ -25,6 +25,7 @@ dayjs.locale('es') // 글로벌 하게 locale을 로드하여 사용합니다.
dayjs.locale('de-german', de) // locale 사용 및 기본 이름 문자열 업데이트
const customizedLocaleObject = { ... } // 자세한 내용은 아래 커스텀 설정 섹션을 참조하세요.
dayjs.locale(customizedLocaleObject) // 커스텀 locale 사용
dayjs.locale('en') // switch back to default English locale globally
```

* 글로벌 locale을 변경해도 기존 인스턴스에는 영향을 주지 않습니다.
Expand Down
1 change: 1 addition & 0 deletions docs/pt-br/I18n.md
Expand Up @@ -25,6 +25,7 @@ dayjs.locale('es') // usar o locale es globalmente
dayjs.locale('de-german', de) // usar o locale de e alterar a string padrão
const customizedLocaleObject = { ... } // mais detalhes podem ser vistos na sessão de customização abaixo
dayjs.locale(customizedLocaleObject) // usar locale customizado
dayjs.locale('en') // switch back to default English locale globally
```

* Mudar o *locale* global não afeta instâncias já existentes.
Expand Down
1 change: 1 addition & 0 deletions docs/zh-cn/I18n.md
Expand Up @@ -25,6 +25,7 @@ dayjs.locale('zh-cn') // 全局使用简体中文
dayjs.locale('de-german', de) // 使用并更新语言包的名字
const customizedLocaleObject = { ... } // 更多细节请参考下方的自定义语言对象
dayjs.locale(customizedLocaleObject) // 使用自定义语言
dayjs.locale('en') // 全局使用默认的英语语言
```

* 改变全局语言并不会影响在此之前生成的实例
Expand Down
12 changes: 7 additions & 5 deletions test/browser.spec.js
Expand Up @@ -20,10 +20,12 @@ describe('Core APIs', function () {
.format('{YYYY} MM-DDTHH:mm:ss')).toBe('{2010} 04-25T00:00:00')
})

it('Date parse - nonstandard date string with only one digit', function () {
expect(dayjs('2018-4-1 1:1:1:22').isValid())
.toBe(true)
expect(dayjs('2018-4-1').isValid())
.toBe(true)
it('Date parse - nonstandard date string', function () {
expect(dayjs('2018-4-1 1:1:1:22').format('YYYY-MM-DD hh:mm:ss'))
.toBe('2018-04-01 01:01:01')
expect(dayjs('2018-4-1').format('YYYY-MM-DD hh:mm:ss'))
.toBe('2018-04-01 12:00:00')
expect(dayjs('2018-4-1 11:49').format('YYYY-MM-DD hh:mm:ss')) // fix ios bug
.toBe('2018-04-01 11:49:00')
})
})

0 comments on commit 922b4e1

Please sign in to comment.