@optimiser/common 1.0.305 → 1.0.306
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.
- package/dist/lib/helper.js +20 -18
- package/package.json +1 -1
package/dist/lib/helper.js
CHANGED
|
@@ -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
|
-
|
|
408
|
+
// if (operator.includes("Fiscal")) {
|
|
409
|
+
if (operator.toLowerCase().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,25 +659,27 @@ 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
|
-
|
|
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
|
+
}
|
|
664
674
|
}
|
|
665
675
|
else {
|
|
666
|
-
|
|
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
|
+
}
|
|
667
682
|
}
|
|
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
|
-
// }
|
|
681
683
|
break;
|
|
682
684
|
default:
|
|
683
685
|
break;
|