@optimiser/common 1.0.302 → 1.0.303

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,8 +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")) {
409
- 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)) {
410
410
  if (fiscalFrom === "End") {
411
411
  fiscalMonth = momentObj.clone().month(fiscalMonth).add(1, "months").format('MMM'); // Modify FiscalMonth in FiscalFrom - End
412
412
  }
@@ -659,27 +659,25 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
659
659
  case "year-to-date":
660
660
  endDate = momentObj.clone().format(requiredDateFormat);
661
661
  // Commented Below Hanisha's Code - Implemented following as per QPC-6370
662
- // if (parseInt(momentObj.format('M')) > 3) {
663
- // startDate = momentObj.clone().startOf('month').month("Apr").format(requiredDateFormat);
664
- // } else {
665
- // startDate = momentObj.clone().subtract(1, "years").startOf('month').month("Apr").format(requiredDateFormat);
666
- // }
667
- if (fiscalFrom === "Start") {
668
- if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex <= momentObj.clone().month()) {
669
- startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).startOf('month').format(requiredDateFormat);
670
- }
671
- else {
672
- startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
673
- }
662
+ if (parseInt(momentObj.format('M')) > 3) {
663
+ startDate = momentObj.clone().startOf('month').month("Apr").format(requiredDateFormat);
674
664
  }
675
665
  else {
676
- if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex < momentObj.clone().month() || getFiscalMonthIndex == 11) {
677
- startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).startOf('month').format(requiredDateFormat);
678
- }
679
- else {
680
- startDate = moment_1.default(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
681
- }
666
+ startDate = momentObj.clone().subtract(1, "years").startOf('month').month("Apr").format(requiredDateFormat);
682
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
+ // }
683
681
  break;
684
682
  default:
685
683
  break;
@@ -4571,6 +4571,9 @@ function ValidateUserInput(options) {
4571
4571
  }
4572
4572
  field = schemaFields.find(function (x) { return x.Name == fieldName; });
4573
4573
  if (!field) return [3 /*break*/, 52];
4574
+ if ((field.UIDataType == 'date' || field.UIDataType == 'datetime') && IsStringValue(fieldData) && fieldData.trim() == '') {
4575
+ inputFields[fieldName] = null;
4576
+ }
4574
4577
  if (fieldData && IsStringValue(fieldData) && field.UIDataType != 'dropdown') {
4575
4578
  fieldData = fieldData.trim();
4576
4579
  if (["text", "email", "phone"].includes(field.UIDataType)) {
@@ -4662,7 +4665,7 @@ function ValidateUserInput(options) {
4662
4665
  {
4663
4666
  filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
4664
4667
  if (!filter.test(fieldData)) {
4665
- msg = 'Invalid email for ' + field.DisplayName + '!';
4668
+ msg = fieldData + ' is invalid email for ' + field.DisplayName + '!';
4666
4669
  }
4667
4670
  }
4668
4671
  return [3 /*break*/, 51];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.302",
3
+ "version": "1.0.303",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {