Skip to content
Snippets Groups Projects
Commit 57cb5b9e authored by Tom Robinson's avatar Tom Robinson
Browse files

Change date filter formatting from 'past' to 'previous'

parent 17e7779f
No related branches found
No related tags found
No related merge requests found
......@@ -132,11 +132,11 @@ export function generateTimeIntervalDescription(n, unit) {
return [t`Next ${formatBucketing(unit)}`];
case "last":
case -1:
return [t`Last ${formatBucketing(unit)}`];
return [t`Previous ${formatBucketing(unit)}`];
}
if (n < 0) {
return [t`Past ${-n} ${formatBucketing(unit, -n)}`];
return [t`Previous ${-n} ${formatBucketing(unit, -n)}`];
} else if (n > 0) {
return [t`Next ${n} ${formatBucketing(unit, n)}`];
} else {
......
......@@ -98,7 +98,7 @@ describe("query_time", () => {
-30,
"day",
]),
).toEqual(["Past 30 Days"]);
).toEqual(["Previous 30 Days"]);
expect(
generateTimeFilterValuesDescriptions([
"time-interval",
......@@ -106,7 +106,7 @@ describe("query_time", () => {
1,
"month",
]),
).toEqual(["Next 1 Month"]);
).toEqual(["Next Month"]);
expect(
generateTimeFilterValuesDescriptions([
"time-interval",
......@@ -130,7 +130,7 @@ describe("query_time", () => {
-1,
"month",
]),
).toEqual(["Past 1 Month"]);
).toEqual(["Previous Month"]);
expect(
generateTimeFilterValuesDescriptions([
"time-interval",
......@@ -138,7 +138,7 @@ describe("query_time", () => {
-2,
"month",
]),
).toEqual(["Past 2 Months"]);
).toEqual(["Previous 2 Months"]);
});
it("should format 'time-interval' short names correctly", () => {
expect(
......
......@@ -34,14 +34,14 @@ describe("TimeseriesFilterWidget", () => {
const widget = mount(getTimeseriesFilterWidget(questionWithoutFilter));
expect(widget.find(".AdminSelect-content").text()).toBe("All Time");
});
it("should display 'Past 30 Days' text if that filter is selected", () => {
it("should display 'Previous 30 Days' text if that filter is selected", () => {
const questionWithFilter = questionWithoutFilter
.query()
.addFilter(["time-interval", ["field-id", 1], -30, "day"])
.question();
const widget = mount(getTimeseriesFilterWidget(questionWithFilter));
expect(widget.find(".AdminSelect-content").text()).toBe("Past 30 Days");
expect(widget.find(".AdminSelect-content").text()).toBe("Previous 30 Days");
});
it("should display 'Is Empty' text if that filter is selected", () => {
const questionWithFilter = questionWithoutFilter
......
......@@ -121,6 +121,6 @@ describe("FieldList", () => {
.last()
.text(),
// eslint-disable-next-line no-irregular-whitespace
).toMatch(/Created AtPast 300 Days/);
).toMatch(/Created AtPrevious 300 Days/);
});
});
......@@ -76,7 +76,7 @@ describe("SegmentPane", () => {
.find(DataReference)
.find(QueryDefinition);
// eslint-disable-next-line no-irregular-whitespace
expect(queryDefinition.text()).toMatch(/Created AtPast 300 Days/);
expect(queryDefinition.text()).toMatch(/Created AtPrevious 300 Days/);
});
it("lets you apply the filter to your current query", async () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment