@magic-xpa/angular 4.1100.0-dev4110.165 → 4.1100.0-dev4110.166

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.
@@ -3468,23 +3468,18 @@ class MgformatMagicDirective {
3468
3468
  const dateArray = userInput.split(separator);
3469
3469
  const [day, month, year] = this.getDateSegments1(dateArray);
3470
3470
  const isMonthInNumber = !isNaN(Number(month));
3471
- if (isMonthInNumber == true) {
3472
- if (day < 32 && Number(month) < 13) {
3473
- this.updateYear(day, month, year, separator, century, centuryVal, control);
3474
- }
3475
- }
3476
- else if (day < 32) {
3471
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3477
3472
  this.updateYear(day, month, year, separator, century, centuryVal, control);
3478
3473
  }
3479
3474
  }
3480
- else if ((dateFormat == 'dd/MM/yyyy' || dateFormat == 'dd-MM-yyyy')) {
3475
+ else if ((dateFormat == 'dd/MM/yyyy' || dateFormat == 'dd-MM-yyyy' || dateFormat == 'd/M/yyyy' || dateFormat == 'd-M-yyyy')) {
3481
3476
  const dateArray = userInput.split(separator);
3482
3477
  const [day, month, year] = this.getDateSegments1(dateArray);
3483
3478
  if ((day < 32 && month < 13)) {
3484
3479
  this.updateYear(day, month, year, separator, century, centuryVal, control);
3485
3480
  }
3486
3481
  }
3487
- else if ((dateFormat == 'MM/dd/yyyy' || dateFormat == 'MM-dd-yyyy')) {
3482
+ else if ((dateFormat == 'MM/dd/yyyy' || dateFormat == 'MM-dd-yyyy' || dateFormat == 'M/d/yyyy' || dateFormat == 'M-d-yyyy')) {
3488
3483
  const dateArray = userInput.split(separator);
3489
3484
  const [day, month, year] = this.getDateSegments2(dateArray);
3490
3485
  if ((day < 32 && month < 13)) {
@@ -3495,12 +3490,7 @@ class MgformatMagicDirective {
3495
3490
  const dateArray = userInput.split(separator);
3496
3491
  const [day, month, year] = this.getDateSegments2(dateArray);
3497
3492
  const isMonthInNumber = !isNaN(Number(month));
3498
- if (isMonthInNumber == true) {
3499
- if (day < 32 && Number(month) < 13) {
3500
- this.updateYear(day, month, year, separator, century, centuryVal, control);
3501
- }
3502
- }
3503
- else if (day < 32) {
3493
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3504
3494
  this.updateYear(day, month, year, separator, century, centuryVal, control);
3505
3495
  }
3506
3496
  }
@@ -3522,23 +3512,18 @@ class MgformatMagicDirective {
3522
3512
  const dateArray = userInput.split(separator);
3523
3513
  const [day, month, year] = this.getDateSegments4(dateArray);
3524
3514
  const isMonthInNumber = !isNaN(Number(month));
3525
- if (isMonthInNumber == true) {
3526
- if (day < 32 && Number(month) < 13) {
3527
- this.updateYear(day, month, year, separator, century, centuryVal, control);
3528
- }
3529
- }
3530
- else if (day < 32) {
3515
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3531
3516
  this.updateYear(day, month, year, separator, century, centuryVal, control);
3532
3517
  }
3533
3518
  }
3534
- else if ((dateFormat == 'dd/MM/yy' || dateFormat == 'dd-MM-yy')) {
3519
+ else if ((dateFormat == 'dd/MM/yy' || dateFormat == 'dd-MM-yy' || dateFormat == 'd/M/yy' || dateFormat == 'd-M-yy')) {
3535
3520
  const dateArray = userInput.split(separator);
3536
3521
  const [day, month, year] = this.getDateSegments1(dateArray);
3537
3522
  if ((day < 32 && month < 13)) {
3538
3523
  this.updateYear(day, month, year, separator, century, centuryVal, control);
3539
3524
  }
3540
3525
  }
3541
- else if ((dateFormat == 'MM/dd/yy' || dateFormat == 'MM-dd-yy')) {
3526
+ else if ((dateFormat == 'MM/dd/yy' || dateFormat == 'MM-dd-yy' || dateFormat == 'M/d/yy' || dateFormat == 'M-d-yy')) {
3542
3527
  const dateArray = userInput.split(separator);
3543
3528
  const [day, month, year] = this.getDateSegments2(dateArray);
3544
3529
  if ((day < 32 && month < 13)) {
@@ -3562,24 +3547,43 @@ class MgformatMagicDirective {
3562
3547
  else if ((dateFormat == 'dd/MMM/yy' || dateFormat == 'dd-MMM-yy')) {
3563
3548
  const dateArray = userInput.split(separator);
3564
3549
  const [day, month, year] = this.getDateSegments1(dateArray);
3565
- if ((day < 32 && month < 13)) {
3550
+ const isMonthInNumber = !isNaN(Number(month));
3551
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3566
3552
  this.updateYear(day, month, year, separator, century, centuryVal, control);
3567
3553
  }
3568
3554
  }
3569
3555
  else if ((dateFormat == 'yy/dd/MMM' || dateFormat == 'yy-dd-MMM')) {
3570
3556
  const dateArray = userInput.split(separator);
3571
3557
  const [day, month, year] = this.getDateSegments4(dateArray);
3572
- if ((day < 32 && month < 13)) {
3558
+ const isMonthInNumber = !isNaN(Number(month));
3559
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3573
3560
  this.updateYear(day, month, year, separator, century, centuryVal, control);
3574
3561
  }
3575
3562
  }
3576
3563
  else if ((dateFormat == 'MMM/dd/yy' || dateFormat == 'MMM-dd-yy')) {
3577
3564
  const dateArray = userInput.split(separator);
3578
3565
  const [day, month, year] = this.getDateSegments2(dateArray);
3579
- if ((day < 32 && month < 13)) {
3566
+ const isMonthInNumber = !isNaN(Number(month));
3567
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3568
+ this.updateYear(day, month, year, separator, century, centuryVal, control);
3569
+ }
3570
+ }
3571
+ else if ((dateFormat == 'yyyy/MMM/dd' || dateFormat == 'yyyy-MMM-dd' || dateFormat == 'yy/MMM/dd' || dateFormat == 'yy-MMM-dd')) {
3572
+ const dateArray = userInput.split(separator);
3573
+ const [day, month, year] = this.getDateSegments3(dateArray);
3574
+ const isMonthInNumber = !isNaN(Number(month));
3575
+ if ((isMonthInNumber && day < 32 && Number(month) < 13) || (!isMonthInNumber && day < 32)) {
3580
3576
  this.updateYear(day, month, year, separator, century, centuryVal, control);
3581
3577
  }
3582
3578
  }
3579
+ else if (dateFormat == 'yyyy/MM' || dateFormat == 'yyyy-MM') {
3580
+ const dateArray = userInput.split(separator);
3581
+ const month = dateArray[1];
3582
+ const year = Number(dateArray[0]);
3583
+ if (Number(month) < 13) {
3584
+ this.updateYear(1, month, year, separator, century, centuryVal, control);
3585
+ }
3586
+ }
3583
3587
  }
3584
3588
  updateYear(day, month, year, separator, century, centuryVal, control) {
3585
3589
  let updatedYear = year.toString().length === 2 ? (year < century % 100 ? centuryVal + 1 : centuryVal) + '' + year :