mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ResponseOps] Snooze Scheduler UX for recurring snoozes shows incorrect summary (#214797)
Solves: https://github.com/elastic/kibana/issues/210119 ## Summary How to test: Reproduce bug from an issue. But create a rule in Stack management. Action is not needed. You can test it on main.   When you add new schedule and save it, you should see proper date here as well:  ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
parent
18aa055a6a
commit
fdd872ada1
3 changed files with 35 additions and 3 deletions
|
@ -71,5 +71,22 @@ describe('Snooze panel helpers', () => {
|
|||
})
|
||||
).toEqual('Every month on the 4th Tuesday for 5 occurrences');
|
||||
});
|
||||
|
||||
test('should capitalize first letter and display correct month for yearly recurrence', () => {
|
||||
expect(
|
||||
scheduleSummary({
|
||||
id: null,
|
||||
duration: 864000,
|
||||
rRule: {
|
||||
dtstart: NOW,
|
||||
tzid: 'UTC',
|
||||
freq: RRuleFrequency.YEARLY,
|
||||
interval: 1,
|
||||
bymonth: [3],
|
||||
bymonthday: [21],
|
||||
},
|
||||
})
|
||||
).toEqual('Every year on March 21');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -133,6 +133,17 @@ describe('Recurrence scheduler helper', () => {
|
|||
).toEqual('every month on the 4th Tuesday');
|
||||
});
|
||||
|
||||
test('should display correct month name for yearly recurrence', () => {
|
||||
expect(
|
||||
recurrenceSummary({
|
||||
freq: RRuleFrequency.YEARLY,
|
||||
interval: 1,
|
||||
bymonth: [3],
|
||||
bymonthday: [18],
|
||||
})
|
||||
).toEqual('every year on March 18');
|
||||
});
|
||||
|
||||
test('should give a basic msg', () => {
|
||||
expect(
|
||||
recurrenceSummary({
|
||||
|
@ -280,7 +291,7 @@ describe('Recurrence scheduler helper', () => {
|
|||
startDate: moment('11/23/2021'),
|
||||
})
|
||||
).toEqual({
|
||||
bymonth: [10],
|
||||
bymonth: [11],
|
||||
bymonthday: [23],
|
||||
byweekday: [],
|
||||
freq: 0,
|
||||
|
|
|
@ -109,7 +109,11 @@ export const recurrenceSummary = ({
|
|||
? i18n.translate('xpack.triggersActionsUI.ruleSnoozeScheduler.bymonthSummary', {
|
||||
defaultMessage: 'on {date}',
|
||||
values: {
|
||||
date: i18nMonthDayDate(moment().month(bymonth[0]).date(bymonthday[0])),
|
||||
date: i18nMonthDayDate(
|
||||
moment()
|
||||
.month(bymonth[0] - 1)
|
||||
.date(bymonthday[0])
|
||||
),
|
||||
},
|
||||
})
|
||||
: null;
|
||||
|
@ -179,7 +183,7 @@ export const buildCustomRecurrenceSchedulerState = ({
|
|||
: [];
|
||||
|
||||
const bymonthday = useByMonthDay ? [startDate.date()] : [];
|
||||
const bymonth = startDate && frequency === RRuleFrequency.YEARLY ? [startDate.month()] : [];
|
||||
const bymonth = startDate && frequency === RRuleFrequency.YEARLY ? [startDate.month() + 1] : [];
|
||||
return {
|
||||
freq: frequency,
|
||||
interval,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue