Fixed issue #2173 - Invalid date causes errors (fixes #2173)

This commit is contained in:
Billy Zhou 2018-10-02 06:45:52 +02:00
parent 6718d2eb7c
commit 381e00b74f
2 changed files with 5 additions and 0 deletions

View file

@ -37,6 +37,7 @@ class App.UiElement.datetime extends App.UiElement.basedate
@buildTimestamp: (currentInput) ->
timestamp = "#{currentInput[0]}T#{currentInput[1]}:00.000Z"
time = new Date( Date.parse(timestamp) )
return '' if isNaN time
time.setMinutes( time.getMinutes() + time.getTimezoneOffset() )
@log 'setNewTime', time.toString()
time.toISOString().replace(/\d\d\.\d\d\dZ$/, '00.000Z')

View file

@ -309,6 +309,10 @@ test( "datetime selector check", function() {
}
deepEqual(params, test_params, 'params check')
// Regression test for issue #2173 - Invalid date causes errors
el.find('.js-datepicker').datepicker('setDate', '01/01/99999')
el.find('.js-datepicker').datepicker('setDate', '01/01/1ABCDEFG')
el.find('.js-datepicker').datepicker('setDate', '01/01/1äöüß')
});
test( "date selector check", function() {