             not val or (val.startDate == null or val.endDate == null)
 
         modelCtrl.$render = ->
-            if not modelCtrl.$viewValue
+            if not modelCtrl.$modelValue
                 return el.val('')
 
-            if modelCtrl.$viewValue.startDate == null
+            if modelCtrl.$modelValue.startDate == null
                 return el.val('')
 
-            return el.val(_formatted(modelCtrl.$viewValue))
+            return el.val(_formatted(modelCtrl.$modelValue))
 
 
         _init = ->

        if attrs.max
            $scope.$watch('dateMax', (date) ->
                if date
                    if not modelCtrl.$isEmpty(modelCtrl.$viewValue)
                        _validateMax(date, modelCtrl.$viewValue.endDate)

                    opts['maxDate'] = moment(date)
                else

        if attrs.min
            $scope.$watch('dateMin', (date) ->
                if date
                    if not modelCtrl.$isEmpty(modelCtrl.$modelValue)
                        _validateMin(date, modelCtrl.$modelValue.startDate)

                    opts['minDate'] = moment(date)
                else
