Fixes: #3866 - Date of datepicker is not localized.
This commit is contained in:
parent
cde6aa513a
commit
16df780314
3 changed files with 17 additions and 3 deletions
|
@ -33,7 +33,7 @@ class App.UiElement.basedate
|
|||
autoclose: true
|
||||
todayBtn: 'linked'
|
||||
todayHighlight: true
|
||||
format: App.i18n.timeFormat().date
|
||||
format: App.i18n.timeFormat()['FORMAT_DATE']
|
||||
rtl: App.i18n.dir() is 'rtl'
|
||||
container: item
|
||||
language: 'custom'
|
||||
|
|
|
@ -1533,7 +1533,7 @@ class InputsRef extends App.ControllerAppContent
|
|||
@$('.js-datepicker3').datepicker(
|
||||
todayHighlight: true
|
||||
startDate: new Date()
|
||||
format: App.i18n.timeFormat().date
|
||||
format: App.i18n.timeFormat()['FORMAT_DATE']
|
||||
rtl: App.i18n.dir() is 'rtl'
|
||||
container: @$('.js-datepicker3').parent()
|
||||
)
|
||||
|
@ -1542,7 +1542,7 @@ class InputsRef extends App.ControllerAppContent
|
|||
@$('.js-datepicker4').datepicker(
|
||||
todayHighlight: true
|
||||
startDate: new Date()
|
||||
format: App.i18n.timeFormat().date
|
||||
format: App.i18n.timeFormat()['FORMAT_DATE']
|
||||
rtl: App.i18n.dir() is 'rtl'
|
||||
container: @$('.js-datepicker4').parent()
|
||||
)
|
||||
|
|
|
@ -157,6 +157,13 @@ QUnit.test('i18n', assert => {
|
|||
date = App.i18n.translateDate(undefined, 0)
|
||||
assert.equal(date, undefined, 'de-de - date translated correctly')
|
||||
|
||||
date = App.i18n.timeFormat()
|
||||
assert.deepEqual(date, { "FORMAT_DATE": "dd.mm.yyyy", "FORMAT_DATETIME": "dd.mm.yyyy HH:MM" }, 'timeFormat property')
|
||||
|
||||
// Verify that the datepicker gets the correct format too.
|
||||
el_date = App.UiElement.date.render({name: 'test', value: '2018-07-06'})
|
||||
assert.equal(el_date.find('.js-datepicker').get(0).value, '06.07.2018')
|
||||
|
||||
// en
|
||||
App.i18n.set('en-us')
|
||||
translated = App.i18n.translateContent('yes')
|
||||
|
@ -234,6 +241,13 @@ QUnit.test('i18n', assert => {
|
|||
date = App.i18n.translateDate(undefined, 0)
|
||||
assert.equal(date, undefined, 'en - date translated correctly')
|
||||
|
||||
date = App.i18n.timeFormat()
|
||||
assert.deepEqual(date, { "FORMAT_DATE": "mm/dd/yyyy", "FORMAT_DATETIME": "mm/dd/yyyy HH:MM" }, 'timeFormat property')
|
||||
|
||||
// Verify that the datepicker gets the correct format too.
|
||||
el_date = App.UiElement.date.render({name: 'test', value: '2018-07-06'})
|
||||
assert.equal(el_date.find('.js-datepicker').get(0).value, '07/06/2018')
|
||||
|
||||
// locale alias test
|
||||
// de
|
||||
App.i18n.set('de')
|
||||
|
|
Loading…
Reference in a new issue