diff --git a/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee index fb83e95d0..aae510769 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee @@ -95,6 +95,8 @@ class App.UiElement.date item.find("[name=\"#{attribute.name}\"]").val(timestamp) @setParams: (item, attribute, time) -> + App.Log.debug 'UiElement.date.setParams', time.toString() + if time.toString() is 'Invalid Date' @setShadowTimestamp(item, attribute) return @@ -109,9 +111,10 @@ class App.UiElement.date @getParams: (item) -> params = {} - params.day = item.find('[data-item=day]').val() - params.month = item.find('[data-item=month]').val() - params.year = item.find('[data-item=year]').val() + params.day = item.find('[data-item=day]').val().trim() + params.month = item.find('[data-item=month]').val().trim() + params.year = item.find('[data-item=year]').val().trim() + App.Log.debug 'UiElement.date.getParams', params params @validation: (item, attribute, runtime) -> @@ -160,6 +163,7 @@ class App.UiElement.date #formGroup = item.closest('.form-group') formGroup = item + App.Log.debug 'UiElement.date.validation', errors if !_.isEmpty(errors) # if field is required, if not do not show error diff --git a/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee index ff1e64c2f..9e48cc2e0 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee @@ -109,6 +109,8 @@ class App.UiElement.datetime item.find("[name=\"#{attribute.name}\"]").val(timestamp) @setParams: (item, attribute, time) -> + App.Log.debug 'UiElement.datetime.setParams', time.toString() + if time.toString() is 'Invalid Date' @setShadowTimestamp(item, attribute) return @@ -127,11 +129,12 @@ class App.UiElement.datetime @getParams: (item) -> params = {} - params.day = item.find('[data-item=day]').val() - params.month = item.find('[data-item=month]').val() - params.year = item.find('[data-item=year]').val() - params.hour = item.find('[data-item=hour]').val() - params.minute = item.find('[data-item=minute]').val() + params.day = item.find('[data-item=day]').val().trim() + params.month = item.find('[data-item=month]').val().trim() + params.year = item.find('[data-item=year]').val().trim() + params.hour = item.find('[data-item=hour]').val().trim() + params.minute = item.find('[data-item=minute]').val().trim() + App.Log.debug 'UiElement.datetime.getParams', params params @validation: (item, attribute, runtime) -> @@ -195,6 +198,7 @@ class App.UiElement.datetime #formGroup = item.closest('.form-group') formGroup = item + App.Log.debug 'UiElement.datetime.validation', errors if !_.isEmpty(errors) # if field is required, if not do not show error