iptdevs-design-system 2.7.116 → 2.7.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/cod/logic/calculate-quotes.service.mjs +16 -6
- package/fesm2015/iptdevs-design-system.mjs +15 -5
- package/fesm2015/iptdevs-design-system.mjs.map +1 -1
- package/fesm2020/iptdevs-design-system.mjs +15 -5
- package/fesm2020/iptdevs-design-system.mjs.map +1 -1
- package/lib/cod/logic/calculate-quotes.service.d.ts +2 -1
- package/package.json +1 -1
|
@@ -3430,12 +3430,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
|
|
|
3430
3430
|
}] } });
|
|
3431
3431
|
|
|
3432
3432
|
class CalculateQuotesService {
|
|
3433
|
-
constructor() {
|
|
3433
|
+
constructor() {
|
|
3434
|
+
this.monthsDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
3435
|
+
}
|
|
3434
3436
|
calculateQuotes(params) {
|
|
3435
3437
|
let dataFinancing = [];
|
|
3436
3438
|
let index = 1; // Indicador de cant. de cuotas
|
|
3437
3439
|
let dateJs = new Date(params.date);
|
|
3440
|
+
let isEndMonth = false;
|
|
3438
3441
|
dateJs.setMilliseconds(dateJs.getMilliseconds() + (1000 * 3600 * 24));
|
|
3442
|
+
isEndMonth = this.monthsDays[dateJs.getMonth()] === dateJs.getDate();
|
|
3443
|
+
console.log('---- end of month ---');
|
|
3444
|
+
console.log(isEndMonth);
|
|
3439
3445
|
if (dateJs.getDay() === 0) {
|
|
3440
3446
|
Swal.fire({
|
|
3441
3447
|
title: 'Fecha inválida',
|
|
@@ -3456,7 +3462,7 @@ class CalculateQuotesService {
|
|
|
3456
3462
|
dataFinancing.push(quota);
|
|
3457
3463
|
while (index < params.quotaTimes) {
|
|
3458
3464
|
index = index + 1;
|
|
3459
|
-
let newJsDate = this.setPlusOneMonth(dateJs);
|
|
3465
|
+
let newJsDate = this.setPlusOneMonth(dateJs, isEndMonth);
|
|
3460
3466
|
let row = [
|
|
3461
3467
|
index,
|
|
3462
3468
|
Intl.NumberFormat('en-US', {
|
|
@@ -3472,15 +3478,19 @@ class CalculateQuotesService {
|
|
|
3472
3478
|
}
|
|
3473
3479
|
return dataFinancing;
|
|
3474
3480
|
}
|
|
3475
|
-
setPlusOneMonth(originDate) {
|
|
3481
|
+
setPlusOneMonth(originDate, isEndMonth) {
|
|
3476
3482
|
let response = [];
|
|
3477
3483
|
let oneDayMilis = 1000 * 3600 * 24;
|
|
3478
|
-
let
|
|
3479
|
-
|
|
3484
|
+
let day = isEndMonth || (originDate.getMonth() === 1 && originDate.getDate() > 28) ? this.monthsDays[originDate.getMonth()] : originDate.getDate();
|
|
3485
|
+
let plusMonthDate = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
|
|
3486
|
+
let initialDate = new Date(originDate.getFullYear(), originDate.getMonth() + 1, day);
|
|
3487
|
+
response.push(initialDate);
|
|
3480
3488
|
while (plusMonthDate.getDay() === 0) {
|
|
3481
3489
|
plusMonthDate.setMilliseconds(originDate.getMilliseconds() - oneDayMilis);
|
|
3482
3490
|
}
|
|
3483
3491
|
response.push(plusMonthDate);
|
|
3492
|
+
console.log('date for ' + day + ' - ' + originDate.getMonth());
|
|
3493
|
+
console.log(response);
|
|
3484
3494
|
return response;
|
|
3485
3495
|
}
|
|
3486
3496
|
getStringDate(originDate) {
|