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) {
|
calculateMinutes(duration, interval) {
|
||||||
if (isBlank(duration)) {
|
if (isBlank(duration) || isNaN(duration)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
</label>
|
</label>
|
||||||
<RelativeTimePicker
|
<RelativeTimePicker
|
||||||
@id="bookmark-relative-time-picker"
|
@id="bookmark-relative-time-picker"
|
||||||
|
@durationMinutes={{this.selectedDurationMins}}
|
||||||
@onChange={{action "relativeTimeChanged"}}
|
@onChange={{action "relativeTimeChanged"}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -52,6 +52,7 @@ export default Component.extend({
|
||||||
selectedDate: null,
|
selectedDate: null,
|
||||||
selectedDatetime: null,
|
selectedDatetime: null,
|
||||||
prefilledDatetime: null,
|
prefilledDatetime: null,
|
||||||
|
selectedDurationMins: null,
|
||||||
|
|
||||||
hiddenOptions: null,
|
hiddenOptions: null,
|
||||||
customOptions: null,
|
customOptions: null,
|
||||||
|
@ -208,7 +209,10 @@ export default Component.extend({
|
||||||
relativeTimeChanged(relativeTimeMins) {
|
relativeTimeChanged(relativeTimeMins) {
|
||||||
let dateTime = now(this.userTimezone).add(relativeTimeMins, "minutes");
|
let dateTime = now(this.userTimezone).add(relativeTimeMins, "minutes");
|
||||||
|
|
||||||
this.set("selectedDatetime", dateTime);
|
this.setProperties({
|
||||||
|
selectedDurationMins: relativeTimeMins,
|
||||||
|
selectedDatetime: dateTime,
|
||||||
|
});
|
||||||
|
|
||||||
if (this.onTimeSelected) {
|
if (this.onTimeSelected) {
|
||||||
this.onTimeSelected(TIME_SHORTCUT_TYPES.RELATIVE, dateTime);
|
this.onTimeSelected(TIME_SHORTCUT_TYPES.RELATIVE, dateTime);
|
||||||
|
|
Loading…
Reference in New Issue