Skip to content

Bug #83031, EM task options fail to load when the task time zone is not in the zone list - #9205

Merged
Nelson-cao merged 1 commit into
mainfrom
fix/bug-83031-em-options-task-zone
Dec 2, 2026
Merged

Nelson-cao merged 1 commit into
mainfrom
fix/bug-83031-em-options-task-zone

Conversation

@Zxm-happy

Copy link
Copy Markdown
Contributor

Cause

Opening an EM schedule task whose task-level time zone is not in the server's zone list (e.g. America/New_York; only US/Eastern is listed) and that has start/stop dates threw in DateTypeFormatter.getMinuteOffset (result undefined -> reading 'minuteOffset') inside the TaskOptionsPane set model setter. The setter aborted before owner/description/locale/time zone were bound, so the pane showed "Invalid user", an empty description, Default locale and Save was disabled. TimeZoneService.updateTimeZoneOptions only added the local zone and condition zones, never the task zone.

Fix

  1. updateTimeZoneOptions(options, conditions, taskTimeZoneId?) adds the task zone (via createTimeZoneOption) when missing, before the no-conditions early return. The EM schedule-task-editor-page passes taskOptionsPaneModel.timeZone on load and after save. Cycle editor and portal callers are unchanged.
  2. getMinuteOffset falls back to getTimeZoneOffset(tz) / 60000 when the zone is not listed, returning 0 for an invalid id instead of throwing.

Not included: NG0955 track change

The NG0955 warning comes from the pre-existing local-zone option sharing an id with a listed zone. Selection identity uses compareWith (id + label), so it is unrelated to this bug and left for a separate issue.

DST note

Offsets are "now"-based, the same definition as the server TimeZoneModel list and getTimeZoneOffset, so a synthesized option behaves like a listed one; conversions stay symmetric.

Tests (vitest, all exit 0; the new cases fail without the production change)

  • shared date-type-formatter.spec.ts: 15 passed (3 new failed before the fix)
  • shared time-zone.service.tl.spec.ts: 28 passed, 1 skipped (3 new)
  • em task-options-pane.component.spec.ts: 28 passed (1 new)
  • em schedule-task-editor-page.component.tl.spec.ts: 28 passed, 3 expected fail (1 new)
  • eslint on the touched production files: clean

Regression case: test/regression/plugin-admin/automated/schedule-tasks/bug-em-options-time-zone-outside-list.test.js (named in the issue; not present on wiz origin/main at the time of this PR)

🤖 Generated with Claude Code

…ck to a computed offset

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Zxm-happy

Copy link
Copy Markdown
Contributor Author

Review r1 (lead's reviewer), head 8073ac1: CLEAN. taskOptionsPaneModel.timeZone is the IANA id; the added option is guarded against duplicates (listed zone or browser zone) and re-added after save; fallback offset getTimeZoneOffset(tz)/60000 is east-positive and now-based, the same convention as TimeZoneModel.minuteOffset, so no date shift. Specs: date-type-formatter 15, task-options-pane 28, time-zone.service.tl + schedule-task-editor-page.tl 56 pass / 3 expected-fail / 1 skipped. Web-only change (no Java gate).

@Nelson-cao Nelson-cao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Ready to merge (head 8073ac1). No blocking issues.

Open verdicts from the conversation

none. The only comment is a CLEAN review (r1) at the current head.

Committed secrets

none (single commit, web TS/spec changes only).

Tests run

no trigger fired (web-only change, no Java/pom, no PR-named test command). Author reports vitest runs; not re-run by me.

Findings

Non-blocking:

  • TimeZoneService.updateTimeZoneOptions now calls createTimeZoneOption(taskTimeZoneId, null), which uses Intl.DateTimeFormat with the zone and throws RangeError for an invalid id. getMinuteOffset guards this with try/catch, but the new add path does not. The task zone comes from the server so an invalid id is unlikely, but a try/catch would match the defensive fallback in the formatter.
  • The duplicate check compares by id only (no label), which is correct for the task-level zone; fine.
  • Fix is minimal, call sites are backward compatible (optional third param; cycle editor/portal unchanged), fallback offset uses the same "now"-based east-positive convention as the listed options. Tests cover the new paths.

@Nelson-cao
Nelson-cao merged commit 26f537c into main Dec 2, 2026
4 checks passed
@Nelson-cao
Nelson-cao deleted the fix/bug-83031-em-options-task-zone branch December 2, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants