iptdevs-design-system 2.7.61 → 2.7.63

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.
@@ -3334,14 +3334,10 @@ class CalculateQuotesService {
3334
3334
  constructor() { }
3335
3335
  calculateQuotes(params) {
3336
3336
  console.log(params.date);
3337
- console.log("--------");
3338
3337
  let dataFinancing = [];
3339
3338
  let index = 1; // Indicador de cant. de cuotas
3340
3339
  let dateJs = new Date(params.date);
3341
- console.log("------ JS --------");
3342
- console.log(dateJs);
3343
- console.log(" ---- +1 ----");
3344
- dateJs.setDate(dateJs.getDate() + 1);
3340
+ dateJs.setMilliseconds(dateJs.getMilliseconds() + (1000 * 3600 * 24));
3345
3341
  console.log(dateJs);
3346
3342
  if (dateJs.getDay() === 0) {
3347
3343
  Swal.fire({
@@ -3358,19 +3354,12 @@ class CalculateQuotesService {
3358
3354
  currency: 'USD',
3359
3355
  minimumFractionDigits: 0
3360
3356
  }).format(Math.round(parseFloat(params.quotaValues.toString()))),
3361
- dateJs.getFullYear() + " " + dateJs.getMonth() + "" + dateJs.getDate()
3357
+ this.getStringDate(dateJs)
3362
3358
  ];
3363
3359
  dataFinancing.push(quota);
3364
3360
  while (index < params.quotaTimes) {
3365
3361
  index = index + 1;
3366
- dateJs.setDate(dateJs.getMonth() + 1);
3367
- while (dateJs.getDay() === 0) {
3368
- console.log("------ JS --------");
3369
- console.log(dateJs);
3370
- console.log(" ---- +1 ----");
3371
- dateJs.setDate(dateJs.getDate() + 1);
3372
- console.log(dateJs);
3373
- }
3362
+ dateJs = this.setPlusOneMonth(dateJs);
3374
3363
  let row = [
3375
3364
  index,
3376
3365
  Intl.NumberFormat('en-US', {
@@ -3378,13 +3367,25 @@ class CalculateQuotesService {
3378
3367
  currency: 'USD',
3379
3368
  minimumFractionDigits: 0
3380
3369
  }).format(Math.round(parseFloat(params.quotaValues.toString()))),
3381
- dateJs.getFullYear() + " " + dateJs.getMonth() + "" + dateJs.getDate()
3370
+ this.getStringDate(dateJs)
3382
3371
  ];
3383
3372
  dataFinancing.push(row);
3384
3373
  }
3385
3374
  }
3386
3375
  return dataFinancing;
3387
3376
  }
3377
+ setPlusOneMonth(originDate) {
3378
+ let oneDayMilis = 1000 * 3600 * 24;
3379
+ let plusMonthDate = new Date(originDate.getFullYear(), originDate.getMonth() + 1, originDate.getDate());
3380
+ while (plusMonthDate.getDay() === 0) {
3381
+ let iterationDate = originDate.getMilliseconds() + oneDayMilis;
3382
+ plusMonthDate = new Date(iterationDate);
3383
+ }
3384
+ return plusMonthDate;
3385
+ }
3386
+ getStringDate(originDate) {
3387
+ return originDate.getFullYear() + ' - ' + (originDate.getMonth() + 1) + ' - ' + originDate.getDate();
3388
+ }
3388
3389
  }
3389
3390
  CalculateQuotesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: CalculateQuotesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3390
3391
  CalculateQuotesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: CalculateQuotesService, providedIn: 'root' });