Leave a date unset when its value is null instead of defaulting to now.
Support unsetting a date when its value is cleared.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
ngModelCtrl.$formatters.unshift(function (modelValue) {
// apply strip_time here in case the user never
// modifies the date value.
+ if (!modelValue) return '';
return dateFilter(strip_time(modelValue), 'yyyy-MM-dd');
});
ngModelCtrl.$parsers.unshift(function(viewValue) {
+ if (!viewValue) return null;
return strip_time(new Date(viewValue));
});
},