Browse Source

fix null error

omassot 6 years ago
parent
commit
d1ab10b8fd
1 changed files with 4 additions and 2 deletions
  1. 4 2
      js/app.js

+ 4 - 2
js/app.js

@@ -598,6 +598,9 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
   };
 
   var formatDate = function(value) {
+	    if (!value || value === 'Invalid date') {
+	        return moment();
+	      }
       if ($scope.results.ftth.date_abonnement_prev.match(/\d{2}\/\d{2}\/\d{2}/)) {
     	  return moment(value, 'DD/MM/YY');
         } else {
@@ -655,8 +658,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
     $.ajax({
       method: 'POST',
       url: 'ajax/db.php',
-      data: $scope.geoCode
-    })
+      data: $scope.geoCode    })
       .error(function(err) {
         console.error('Database issue', err);
       })