Skip to content

Commit 5148f0c

Browse files
authored
Merge pull request g00fy-#279 from jharting/empty-input
Tolerate empty input (as long as it is not required)
2 parents 56daa2e + 4204a42 commit 5148f0c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/scripts/input.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,19 @@ Module.directive('dateTime', ['$compile', '$document', '$filter', 'dateTimeConfi
7676
views.unshift(view);
7777

7878
function formatter(value) {
79-
return dateFilter(value, format, timezone);
79+
if (value) {
80+
return dateFilter(value, format, timezone);
81+
}
8082
}
8183

8284
function parser(viewValue) {
85+
if (!viewValue) {
86+
return '';
87+
}
8388
var parsed = moment(viewValue, format);
8489
if (parsed.isValid()) {
8590
return parsed;
8691
}
87-
return undefined;
8892
}
8993

9094
function setMin(date) {

0 commit comments

Comments
 (0)