@optimiser/common 1.0.449 → 1.0.450
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 +26 -1
- package/package.json +1 -1
package/dist/lib/helper.js
CHANGED
|
@@ -409,7 +409,7 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
|
|
|
409
409
|
var getFiscalMonthIndex = moment_1.default.monthsShort().findIndex(function (month) { return month === fiscalMonth; });
|
|
410
410
|
// GET FISCAL MONTH INDEX
|
|
411
411
|
// if (operator.includes("Fiscal")) {
|
|
412
|
-
if (operator.toLowerCase().includes("fiscal") || ["Year to Date", "year-to-date"].includes(operator)) {
|
|
412
|
+
if (operator.toLowerCase().includes("fiscal") || ["Year to Date", "year-to-date", "Year to Date Last Year", "year-to-date-last-year"].includes(operator)) {
|
|
413
413
|
if (fiscalFrom === "End") {
|
|
414
414
|
fiscalMonth = momentObj.clone().month(fiscalMonth).add(1, "months").format('MMM'); // Modify FiscalMonth in FiscalFrom - End
|
|
415
415
|
}
|
|
@@ -684,6 +684,31 @@ var GetDateRangeFromOperatorValue = function (operator, fiscalMonth, fiscalFrom)
|
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
686
|
break;
|
|
687
|
+
case "Year to Date Last Year":
|
|
688
|
+
case "year-to-date-last-year":
|
|
689
|
+
endDate = momentObj.clone().subtract(1, "years").format(requiredDateFormat);
|
|
690
|
+
if (fiscalFrom === "Start") {
|
|
691
|
+
if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex <= momentObj.clone().month()) {
|
|
692
|
+
startDate = (0, moment_1.default)(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
startDate = (0, moment_1.default)(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(24, "months").startOf('month').format(requiredDateFormat);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
if (getFiscalMonthIndex == 0 || getFiscalMonthIndex && getFiscalMonthIndex < momentObj.clone().month() || getFiscalMonthIndex == 11) {
|
|
700
|
+
startDate = (0, moment_1.default)(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(12, "months").startOf('month').format(requiredDateFormat);
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
startDate = (0, moment_1.default)(startDate, currentDateFormat).clone().month(fiscalMonth).subtract(24, "months").startOf('month').format(requiredDateFormat);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
break;
|
|
707
|
+
case "This Month Last Year":
|
|
708
|
+
case "this-month-last-year":
|
|
709
|
+
startDate = momentObj.clone().subtract(12, "months").startOf('month').format(requiredDateFormat);
|
|
710
|
+
endDate = momentObj.clone().subtract(12, "months").endOf('month').format(requiredDateFormat);
|
|
711
|
+
break;
|
|
687
712
|
default:
|
|
688
713
|
break;
|
|
689
714
|
}
|