diff --git a/app/javascript/components/insights-sub-report/utils/translate-group-id.js b/app/javascript/components/insights-sub-report/utils/translate-group-id.js index 262d9b29fd..9725a50f1d 100644 --- a/app/javascript/components/insights-sub-report/utils/translate-group-id.js +++ b/app/javascript/components/insights-sub-report/utils/translate-group-id.js @@ -10,7 +10,7 @@ export default (groupId, groupedBy, localizeDate) => { case MONTH: { const [year, groupKey] = groupId.split("-"); - return `${year}-${groupTranslator(groupKey, localizeDate)}`; + return `${groupTranslator(groupKey, localizeDate)}-${year}`; } case WEEK: { const [start, end] = groupId.split(" - "); diff --git a/app/javascript/components/insights-sub-report/utils/translate-group-id.unit.test.js b/app/javascript/components/insights-sub-report/utils/translate-group-id.unit.test.js index dc824d7796..ccb0d3c078 100644 --- a/app/javascript/components/insights-sub-report/utils/translate-group-id.unit.test.js +++ b/app/javascript/components/insights-sub-report/utils/translate-group-id.unit.test.js @@ -14,13 +14,13 @@ describe("translateGroupId", () => { it("translates group of months", () => { const result = translateGroupId("2023-03", MONTH, format); - expect(result).to.equals("2023-Mar"); + expect(result).to.equals("Mar-2023"); }); it("translates group of quarters", () => { const result = translateGroupId("2023-Q1", QUARTER, format); - expect(result).to.equals("2023-Q1"); + expect(result).to.equals("Q1-2023"); }); it("translates group of weeks", () => { @@ -28,6 +28,6 @@ describe("translateGroupId", () => { const result = translateGroupId("2023-01-01 - 2023-01-07", WEEK, localizeDate); - expect(result).to.equals("2023-Jan-01 - 2023-Jan-07"); + expect(result).to.equals("01-Jan-2023 - 07-Jan-2023"); }); }); diff --git a/app/javascript/components/insights-sub-report/utils/translate-week.js b/app/javascript/components/insights-sub-report/utils/translate-week.js index 0105a70641..6abcd07cc9 100644 --- a/app/javascript/components/insights-sub-report/utils/translate-week.js +++ b/app/javascript/components/insights-sub-report/utils/translate-week.js @@ -1,3 +1,3 @@ export default (startDate, endDate, localizeDate) => { - return `${localizeDate(startDate, "yyyy-MMM-dd")} - ${localizeDate(endDate, "yyyy-MMM-dd")}`; + return `${localizeDate(startDate, "dd-MMM-yyyy")} - ${localizeDate(endDate, "dd-MMM-yyyy")}`; }; diff --git a/app/javascript/components/insights-sub-report/utils/translate-week.unit.test.js b/app/javascript/components/insights-sub-report/utils/translate-week.unit.test.js index 4723c2628a..73e0e140c0 100644 --- a/app/javascript/components/insights-sub-report/utils/translate-week.unit.test.js +++ b/app/javascript/components/insights-sub-report/utils/translate-week.unit.test.js @@ -7,6 +7,6 @@ describe("translateWeek", () => { const localizeDate = (value, dateFormat) => format(parseISO(value), dateFormat); const result = translateWeek("2020-06-07", "2020-06-13", localizeDate); - expect(result).to.equal("2020-Jun-07 - 2020-Jun-13"); + expect(result).to.equal("07-Jun-2020 - 13-Jun-2020"); }); });