|
|
@@ -563,8 +563,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
// Si date de début de travaux réelle est renseignée
|
|
|
if ($scope.results.ftth.date_deb_trav_reel) {
|
|
|
// Compute Date
|
|
|
- momentDate = moment($scope.results.ftth.date_deb_trav_reel, 'DD/MM/YY');
|
|
|
-
|
|
|
+ momentDate = formatDate($scope.results.ftth.date_deb_trav_reel);
|
|
|
momentDate.add(nbJoursFTTH, 'days');
|
|
|
|
|
|
var semester = '1er';
|
|
|
@@ -580,7 +579,9 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
) {
|
|
|
// Si date de début de travaux prévisionnelle est renseignée
|
|
|
// Compute Date
|
|
|
- momentDate = moment($scope.results.ftth.date_abonnement_prev, 'DD/MM/YY');
|
|
|
+
|
|
|
+ momentDate = formatDate($scope.results.ftth.date_abonnement_prev);
|
|
|
+
|
|
|
momentDate.add(nbJoursFTTH, 'days');
|
|
|
|
|
|
var semester = '1er';
|
|
|
@@ -597,7 +598,11 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
};
|
|
|
|
|
|
var formatDate = function(value) {
|
|
|
- return moment(value, 'YYYY-MM-DD');
|
|
|
+ if ($scope.results.ftth.date_abonnement_prev.match(/\d{2}\/\d{2}\/\d{2}/)) {
|
|
|
+ return moment(value, 'DD/MM/YY');
|
|
|
+ } else {
|
|
|
+ return moment(value, 'YYYY-MM-DD');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
var getFullAddress = function(callback) {
|
|
|
@@ -1073,9 +1078,9 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- var dateDeb = moment($scope.results.ftth.date_ouv_bul_preracco, 'YYYY-MM-DD');
|
|
|
- var dateFin = moment($scope.results.ftth.date_ferm_bul_preracco, 'YYYY-MM-DD');
|
|
|
- var dateCom = moment($scope.results.ftth.date_ouv_commercialisation, 'YYYY-MM-DD');
|
|
|
+ var dateDeb = formatDate($scope.results.ftth.date_ouv_bul_preracco);
|
|
|
+ var dateFin = formatDate($scope.results.ftth.date_ferm_bul_preracco);
|
|
|
+ var dateCom = formatDate($scope.results.ftth.date_ouv_commercialisation);
|
|
|
var dateEndButton = dateFin.add(31, 'days');
|
|
|
|
|
|
var now = moment();
|
|
|
@@ -1129,7 +1134,7 @@ app.controller('mainController', function($scope, $detection, $http, $mdSidenav,
|
|
|
message = 'L’inscription sera possible à partir du ' + dateDeb.lang('fr').format('ll');
|
|
|
cas = 2;
|
|
|
} else if ($scope.results.ftth.date_deb_trav_prev) {
|
|
|
- var date = moment($scope.results.ftth.date_deb_trav_prev, 'YYYY-MM-DD').add(24, 'M');
|
|
|
+ var date = formatDate($scope.results.ftth.date_deb_trav_prev).add(24, 'M');
|
|
|
|
|
|
message = null;
|
|
|
cas = 1;
|