andre 4 лет назад
Родитель
Сommit
9e1795a25a
1 измененных файлов с 11 добавлено и 10 удалено
  1. 11 10
      js/scripts.js

+ 11 - 10
js/scripts.js

@@ -3821,36 +3821,37 @@ function updateProductTotalMessage(billingcycle) {
     var orderDay = daysIntoYear(new Date(now.getFullYear(), now.getMonth(), now.getDate()));
     switch(billingcycle) {
         case 'monthly':
-            billingDay = daysIntoYear(new Date(now.getFullYear(), now.getMonth() + 1, 0));
+            billingDate = new Date(now.getFullYear(), now.getMonth() + 1, 0);
             break;
         case 'quarterly':
             if (now.getMonth() < 3) {
-                billingDay = daysIntoYear(new Date(now.getFullYear(), 2, 31)); // 31.3.
+                billingDate = new Date(now.getFullYear(), 2, 31); // 31.3.
             } else if (now.getMonth() < 6) {
-                billingDay = daysIntoYear(new Date(now.getFullYear(), 5, 30)); // 30.6.
+                billingDate = new Date(now.getFullYear(), 5, 30); // 30.6.
             } else if (now.getMonth() < 9) {
-                billingDay = daysIntoYear(new Date(now.getFullYear(), 8, 30)); // 30.9.
+                billingDate = new Date(now.getFullYear(), 8, 30); // 30.9.
             } else {
-                billingDay = daysIntoYear(new Date(now.getFullYear(), 11, 31)); // 31.12.
+                billingDate = new Date(now.getFullYear(), 11, 31); // 31.12.
             }
             break;
         case 'semiannually':
             if (now.getMonth() < 6) {
-                billingDay = daysIntoYear(new Date(now.getFullYear(), 5, 30)); // 30.6.
+                billingDate = new Date(now.getFullYear(), 5, 30); // 30.6.
             } else {
-                billingDay = daysIntoYear(new Date(now.getFullYear(), 11, 31)); // 31.12.
+                billingDate = new Date(now.getFullYear(), 11, 31); // 31.12.
             }
             break;
         case 'annually':
-            billingDay = daysIntoYear(new Date(now.getFullYear(), 11, 31));
+            billingDate = (new Date(now.getFullYear(), 11, 31);
             break;
     }
+    billingDay = daysIntoYear(billingDate);
     if ((billingDay - orderDay) < 12) {
-        jQuery('#producttotalmessage').html('Der Preis summiert sich aus den letzten ' + (billingDay - orderDay) + ' Tagen der aktuellen Zahlungsperiode und der folgenden.<br><br>');
+        jQuery('#producttotalmessage').html('Der Preis summiert sich aus den verbleibenden ' + (billingDay - orderDay) + ' Tagen der aktuellen Zahlungsperiode und der folgenden.<br><br>`);
     } else {
         jQuery('#producttotalmessage').html('Der Preis berechnet die letzten ' + (billingDay - orderDay) + ' Tage der aktuellen Zahlungsperiode.<br><br>');
     }
-    console.log(billingDay - orderDay);
+    console.log((billingDay - orderDay)) + 'Zahltag: ' + billingDate;
 }
 
 function daysIntoYear(date){