diff --git a/src/core/features/reminders/components/date/date.html b/src/core/features/reminders/components/date/date.html index 69d18876a..917907430 100644 --- a/src/core/features/reminders/components/date/date.html +++ b/src/core/features/reminders/components/date/date.html @@ -4,4 +4,4 @@ + [label]="label" [initialTimebefore]="timebefore" [time]="time" [title]="title" [url]="url" /> diff --git a/src/core/features/reminders/components/set-button/set-button.html b/src/core/features/reminders/components/set-button/set-button.html index 0d9b2a488..803f90ae0 100644 --- a/src/core/features/reminders/components/set-button/set-button.html +++ b/src/core/features/reminders/components/set-button/set-button.html @@ -1,6 +1,7 @@ + [attr.aria-label]="'core.reminders.setareminderfor' | translate : { title: title, label: labelClean }"> + +{{ reminderMessage }} diff --git a/src/core/features/reminders/components/set-button/set-button.ts b/src/core/features/reminders/components/set-button/set-button.ts index a443e9d35..a775ad6a8 100644 --- a/src/core/features/reminders/components/set-button/set-button.ts +++ b/src/core/features/reminders/components/set-button/set-button.ts @@ -32,18 +32,22 @@ export class CoreRemindersSetButtonComponent implements OnInit { @Input() instanceId?: number; @Input() type?: string; @Input() label = ''; - @Input() timebefore?: number; + @Input() initialTimebefore?: number; @Input() time = -1; @Input() title = ''; @Input() url = ''; labelClean = ''; + timebefore?: number; + reminderMessage?: string; /** * @inheritdoc */ ngOnInit(): void { this.labelClean = this.label.replace(':', ''); + + this.setTimebefore(this.initialTimebefore); } /** @@ -86,6 +90,23 @@ export class CoreRemindersSetButtonComponent implements OnInit { this.saveReminder(reminderTime.timeBefore); } + /** + * Update time before. + */ + setTimebefore(timebefore: number | undefined): void { + this.timebefore = timebefore; + + if (this.timebefore !== undefined) { + const reminderTime = this.time - this.timebefore; + + this.reminderMessage = Translate.instant('core.reminders.reminderset', { + $a: CoreTimeUtils.userDate(reminderTime * 1000), + }); + } else { + this.reminderMessage = undefined; + } + } + /** * Save reminder. * @@ -105,18 +126,18 @@ export class CoreRemindersSetButtonComponent implements OnInit { }); if (timebefore === undefined || timebefore === CoreRemindersService.DISABLED) { - this.timebefore = undefined; + this.setTimebefore(undefined); CoreDomUtils.showToast('core.reminders.reminderunset', true); return; } - this.timebefore = timebefore; + this.setTimebefore(timebefore); const reminder: CoreReminderData = { + timebefore, component: this.component, instanceId: this.instanceId, - timebefore: this.timebefore, type: this.type, title: this.label + ' ' + this.title, url: this.url,