diff --git a/src/common.js b/src/common.js index 40b969e8cf..ac83f6925b 100644 --- a/src/common.js +++ b/src/common.js @@ -127,8 +127,11 @@ }; Sao.common.parse_datetime = function(date_format, time_format, value) { - var date = Sao.DateTime( - jQuery.datepicker.parseDate(date_format, value)); + value = jQuery.datepicker.parseDate(date_format, value); + if (!value) { + return null; + } + var date = Sao.DateTime(value); var time_value = value.replace(jQuery.datepicker.formatDate( date_format, date), '').trim(); var time = Sao.common.parse_time(time_format, time_value); diff --git a/src/model.js b/src/model.js index 6694a19019..3b269c4aec 100644 --- a/src/model.js +++ b/src/model.js @@ -1232,8 +1232,11 @@ set_client: function(record, value, force_change) { if (typeof value == 'string') { try { - value = Sao.Date(jQuery.datepicker.parseDate( - Sao.common.date_format(), value)); + value = jQuery.datepicker.parseDate( + Sao.common.date_format(), value); + if (value) { + value = Sao.Date(value); + } } catch (e) { value = this._default; }