Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

GDGT-1356: Alert Notification Cron Syntax is misleading (#68834)

Stas Gavryloveea96b247727
diff --git a/frontend/src/metabase/lib/cron.ts b/frontend/src/metabase/lib/cron.ts
index 302894eb1b3..f25d53f2315 100644
--- a/frontend/src/metabase/lib/cron.ts
+++ b/frontend/src/metabase/lib/cron.ts
@@ -65,6 +65,7 @@ export function explainCronExpression(cronExpression: string) {
verbose: false,
locale: MetabaseSettings.get("site-locale"),
use24HourTimeFormat: has24HourModeSetting(),
+ dayOfWeekStartIndexZero: false,
});
}
diff --git a/frontend/src/metabase/notifications/modals/CreateOrEditQuestionAlertModal/components/NotificationSchedule/NotificationSchedule.unit.spec.tsx b/frontend/src/metabase/notifications/modals/CreateOrEditQuestionAlertModal/components/NotificationSchedule/NotificationSchedule.unit.spec.tsx
index 04ea5ebf359..46e798fe935 100644
--- a/frontend/src/metabase/notifications/modals/CreateOrEditQuestionAlertModal/components/NotificationSchedule/NotificationSchedule.unit.spec.tsx
+++ b/frontend/src/metabase/notifications/modals/CreateOrEditQuestionAlertModal/components/NotificationSchedule/NotificationSchedule.unit.spec.tsx
@@ -4,6 +4,26 @@ import type { ScheduleDisplayType } from "metabase-types/api";
import { setup } from "./setup.spec";
describe("NotificationSchedule", () => {
+ it("raw - should correctly parse day of week from cron expression", () => {
+ // In Quartz cron format, days are 1-based: 1=SUN, 2=MON, ..., 7=SAT
+ // "0 0 9 ? * 2,4,6 *" means Monday, Wednesday, Friday at 9:00 AM
+ setup({
+ subscription: {
+ id: 1,
+ notification_id: 1,
+ type: "notification-subscription/cron",
+ event_name: null,
+ cron_schedule: "0 0 9 ? * 2,4,6 *",
+ created_at: "2025-03-14T16:11:12Z",
+ ui_display_type: "cron/raw",
+ },
+ });
+
+ expect(
+ screen.getByText(/Monday, Wednesday, and Friday/),
+ ).toBeInTheDocument();
+ });
+
["builder", "raw"].forEach((uiDisplayType) => {
it(`${uiDisplayType} - should show warning when notification schedule is set to less than 10 minutes`, () => {
setup({