Use null for empty Date

review13391003
This commit is contained in:
C?dric Krier 2014-07-09 00:36:28 +02:00
parent 7bea43287c
commit c9064ff9b5
2 changed files with 10 additions and 4 deletions

View file

@ -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);

View file

@ -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;
}