From: Agnibho Mondal Date: Mon, 17 Oct 2016 18:20:53 +0000 (+0530) Subject: Added maturation by date X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=da2f655ad630fda8a2b9fd9e8e9112b917279dd6;p=obscalc.git Added maturation by date --- diff --git a/index.html b/index.html index ee94fcf..665c7de 100755 --- a/index.html +++ b/index.html @@ -97,6 +97,10 @@ L.M.P.E.D.D. {{showDate(lmp_dt)}}{{showDate(edd_dt)}} +
+ + +
Maturation by Date at present{{calcDate()}}
@@ -193,14 +197,25 @@ $scope.lmp_dt=null; } }; + $scope.calcDate=function(){ + if($scope.lmp_dt!=null){ + dt=moment($scope.lmp_dt); + if(dt.isValid()){ + today=moment(); + days=today.diff(dt, "days"); + if(days>0){ + return Math.floor(days/7)+" weeks "+days%7+" days"; + } + } + } + }; $scope.calcUsg=function(){ if($scope.usg_dt!=null){ - dt=moment($scope.usg_dt); + dt=moment($scope.usg_dt); if(dt.isValid()){ if($scope.usg_wk>=0 && $scope.usg_wk<=52 && $scope.usg_dy>=0 && $scope.usg_dy<=6){ today=moment(); diff=today.diff(dt, "days"); - console.log(diff); days=$scope.usg_wk*7+$scope.usg_dy+diff; return Math.floor(days/7)+" weeks "+days%7+" days"; }