Skip to content

Commit

Permalink
Merged in r2-2618-insights-date-format (pull request #6557)
Browse files Browse the repository at this point in the history
R2-2618 Date format in Insights should match format used in rest of app

Approved-by: Joshua Toliver
  • Loading branch information
aespinoza-quoin authored and jtoliver-quoin committed Oct 24, 2023
2 parents 59e2385 + 45e8153 commit dd2ba92
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(" - ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ 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", () => {
const localizeDate = (value, dateFormat) => format(parseISO(value), dateFormat);

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");
});
});
Original file line number Diff line number Diff line change
@@ -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")}`;
};
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});

0 comments on commit dd2ba92

Please sign in to comment.