Skip to content

A platform for community discussion. Free, open, simple.

UX: change default unit from mins to days (#37899)

chapoi3128754262a7
diff --git a/frontend/discourse/app/components/relative-time-picker.gjs b/frontend/discourse/app/components/relative-time-picker.gjs
index 7f89af84626..42a18529d60 100644
--- a/frontend/discourse/app/components/relative-time-picker.gjs
+++ b/frontend/discourse/app/components/relative-time-picker.gjs
@@ -124,7 +124,7 @@ export default class RelativeTimePicker extends Component {
} else if (this.args.durationHours !== undefined) {
this.interval = intervalFromMinutes(this.args.durationHours * HOUR);
} else {
- this.interval = "mins";
+ this.interval = "days";
}
this.duration = this.minutesFromInputValueAndInterval(
diff --git a/frontend/discourse/tests/integration/components/relative-time-picker-test.gjs b/frontend/discourse/tests/integration/components/relative-time-picker-test.gjs
index b7efc967602..4f53b503a20 100644
--- a/frontend/discourse/tests/integration/components/relative-time-picker-test.gjs
+++ b/frontend/discourse/tests/integration/components/relative-time-picker-test.gjs
@@ -15,24 +15,28 @@ module("Integration | Component | relative-time-picker", function (hooks) {
<template><RelativeTimePicker @onChange={{update}} /></template>
);
- // empty and "minutes" by default
+ // empty and "days" by default
assert.dom(".relative-time-duration").hasValue("");
assert.strictEqual(
selectKit().header().value(),
- "mins",
- "dropdown has 'minutes' preselected"
+ "days",
+ "dropdown has 'days' preselected"
);
- // type <60 minutes
- await typeIn(".relative-time-duration", "50");
- assert.dom(".relative-time-duration").hasValue("50");
- assert.strictEqual(updatedValue, 50, "onChange called with 50");
+ // type 5 days
+ await typeIn(".relative-time-duration", "5");
+ assert.dom(".relative-time-duration").hasValue("5");
+ assert.strictEqual(
+ updatedValue,
+ 5 * 60 * 24,
+ "onChange called with 5 days in minutes"
+ );
// select "hours"
await selectKit().expand();
await selectKit().selectRowByValue("hours");
- assert.dom(".relative-time-duration").hasValue("50");
- assert.strictEqual(updatedValue, 50 * 60, "onChange called with 50 * 60");
+ assert.dom(".relative-time-duration").hasValue("5");
+ assert.strictEqual(updatedValue, 5 * 60, "onChange called with 5 * 60");
// clear the duration
await fillIn(".relative-time-duration", "");