@optimiser/common 1.0.300 → 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.
@@ -405,7 +405,8 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
405
405
  var momentObj = moment_1.default();
406
406
  var getFiscalMonthIndex = moment_1.default.monthsShort().findIndex(function (month) { return month === fiscalMonth; });
407
407
  // GET FISCAL MONTH INDEX
408
- if (operator.includes("Fiscal") || ["Year to Date", "year-to-date"].includes(operator)) {
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
  }
@@ -658,27 +659,25 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
658
659
  case "year-to-date":
659
660
  endDate = momentObj.clone().format(requiredDateFormat);
660
661
  // Commented Below Hanisha's Code - Implemented following as per QPC-6370
661
- // if (parseInt(momentObj.format('M')) > 3) {
662
- // startDate = momentObj.clone().startOf('month').month("Apr").format(requiredDateFormat);
663
- // } else {
664
- // startDate = momentObj.clone().subtract(1, "years").startOf('month').month("Apr").format(requiredDateFormat);
665
- // }
666
- if (fiscalFrom === "Start") {
667
- if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex <= momentObj.clone().month()) {
668
- startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).startOf('month').format(requiredDateFormat);
669
- }
670
- else {
671
- startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
672
- }
662
+ if (parseInt(momentObj.format('M')) > 3) {
663
+ startDate = momentObj.clone().startOf('month').month("Apr").format(requiredDateFormat);
673
664
  }
674
665
  else {
675
- if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex < momentObj.clone().month() || getFiscalMonthIndex == 11) {
676
- startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).startOf('month').format(requiredDateFormat);
677
- }
678
- else {
679
- startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
680
- }
666
+ startDate = momentObj.clone().subtract(1, "years").startOf('month').month("Apr").format(requiredDateFormat);
681
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
+ // }
682
681
  break;
683
682
  default:
684
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.300",
3
+ "version": "1.0.301",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {