iptdevs-design-system 2.7.61 → 2.7.62

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