@optimiser/common 1.0.299 → 1.0.301

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.
@@ -406,6 +406,7 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
406
406
  var getFiscalMonthIndex = moment_1.default.monthsShort().findIndex(function (month) { return month === fiscalMonth; });
407
407
  // GET FISCAL MONTH INDEX
408
408
  if (operator.includes("Fiscal")) {
409
+ // if (operator.includes("Fiscal") || ["Year to Date","year-to-date"].includes(operator)) {
409
410
  if (fiscalFrom === "End") {
410
411
  fiscalMonth = momentObj.clone().month(fiscalMonth).add(1, "months").format('MMM'); // Modify FiscalMonth in FiscalFrom - End
411
412
  }
@@ -657,12 +658,26 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
657
658
  case "Year to Date":
658
659
  case "year-to-date":
659
660
  endDate = momentObj.clone().format(requiredDateFormat);
661
+ // Commented Below Hanisha's Code - Implemented following as per QPC-6370
660
662
  if (parseInt(momentObj.format('M')) > 3) {
661
663
  startDate = momentObj.clone().startOf('month').month("Apr").format(requiredDateFormat);
662
664
  }
663
665
  else {
664
666
  startDate = momentObj.clone().subtract(1, "years").startOf('month').month("Apr").format(requiredDateFormat);
665
667
  }
668
+ // if (fiscalFrom === "Start") {
669
+ // if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex <= momentObj.clone().month()) {
670
+ // startDate = moment(startDate, currentDateFormat).clone().month(fiscalMonth).startOf('month').format(requiredDateFormat);
671
+ // } else {
672
+ // startDate = moment(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
673
+ // }
674
+ // } else {
675
+ // if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex < momentObj.clone().month() || getFiscalMonthIndex == 11) {
676
+ // startDate = moment(startDate, currentDateFormat).clone().month(fiscalMonth).startOf('month').format(requiredDateFormat);
677
+ // } else {
678
+ // startDate = moment(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
679
+ // }
680
+ // }
666
681
  break;
667
682
  default:
668
683
  break;
@@ -4635,10 +4635,10 @@ function ValidateUserInput(options) {
4635
4635
  else if (field.UIDataType == 'decimal' && isNaN(fieldData)) {
4636
4636
  msg = 'Invalid value for ' + field.DisplayName + '!';
4637
4637
  }
4638
- else if (field.MinValue !== undefined && fieldData < field.MinValue) {
4638
+ else if (field.MinValue !== undefined && field.MinValue !== null && fieldData < field.MinValue) {
4639
4639
  msg = field.DisplayName + ' value must be greater then or equal to ' + field.MinValue;
4640
4640
  }
4641
- else if (field.MinValue !== undefined && field.MaxValue < fieldData) {
4641
+ else if (field.MaxValue !== undefined && field.MaxValue !== null && field.MaxValue < fieldData) {
4642
4642
  msg = field.DisplayName + ' value must be smaller then or equal to ' + field.MaxValue;
4643
4643
  }
4644
4644
  }
@@ -4879,7 +4879,7 @@ function ValidateUserInput(options) {
4879
4879
  case 45:
4880
4880
  {
4881
4881
  // Maxlength check;
4882
- if (field.MaxLength !== undefined && fieldData.length > field.MaxLength) {
4882
+ if (field.MaxLength !== undefined && field.MaxLength !== null && fieldData.length > field.MaxLength) {
4883
4883
  msg = field.DisplayName + ' can not be greater then ' + field.MaxLength + ' characters!';
4884
4884
  }
4885
4885
  if (!IsStringValue(fieldData)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.299",
3
+ "version": "1.0.301",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {