mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 17:06:31 -06:00
FIX: set selected duration to relative time picker component (#26997)
When the duration of relative time picker change we should update the input argument too.
This commit is contained in:
parent
334e8c0fcb
commit
262393282d
@ -125,7 +125,7 @@ export default class RelativeTimePicker extends Component {
|
||||
}
|
||||
|
||||
calculateMinutes(duration, interval) {
|
||||
if (isBlank(duration)) {
|
||||
if (isBlank(duration) || isNaN(duration)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
</label>
|
||||
<RelativeTimePicker
|
||||
@id="bookmark-relative-time-picker"
|
||||
@durationMinutes={{this.selectedDurationMins}}
|
||||
@onChange={{action "relativeTimeChanged"}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -52,6 +52,7 @@ export default Component.extend({
|
||||
selectedDate: null,
|
||||
selectedDatetime: null,
|
||||
prefilledDatetime: null,
|
||||
selectedDurationMins: null,
|
||||
|
||||
hiddenOptions: null,
|
||||
customOptions: null,
|
||||
@ -208,7 +209,10 @@ export default Component.extend({
|
||||
relativeTimeChanged(relativeTimeMins) {
|
||||
let dateTime = now(this.userTimezone).add(relativeTimeMins, "minutes");
|
||||
|
||||
this.set("selectedDatetime", dateTime);
|
||||
this.setProperties({
|
||||
selectedDurationMins: relativeTimeMins,
|
||||
selectedDatetime: dateTime,
|
||||
});
|
||||
|
||||
if (this.onTimeSelected) {
|
||||
this.onTimeSelected(TIME_SHORTCUT_TYPES.RELATIVE, dateTime);
|
||||
|
Loading…
Reference in New Issue
Block a user