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:
Vinoth Kannan 2024-05-13 17:48:46 +08:00 committed by GitHub
parent 334e8c0fcb
commit 262393282d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -125,7 +125,7 @@ export default class RelativeTimePicker extends Component {
}
calculateMinutes(duration, interval) {
if (isBlank(duration)) {
if (isBlank(duration) || isNaN(duration)) {
return null;
}

View File

@ -41,6 +41,7 @@
</label>
<RelativeTimePicker
@id="bookmark-relative-time-picker"
@durationMinutes={{this.selectedDurationMins}}
@onChange={{action "relativeTimeChanged"}}
/>
</div>

View File

@ -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);