The outline tab's course end and certificate status alerts ignore the learner's time zone preference
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 56/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, react
- Ambito
- frontend
Direzione di ricerca
Start with useCourseEndAlert and useCertificateStatusAlert in the outline tab, then compare their time zone reads with CourseDates.jsx and check how CertificateStatusAlert.jsx passes formatting arguments to its FormattedDate elements. The issue also describes the outline test suite and the relevant test cases to add. Done means both alerts use the course metadata time zone when present and the browser time zone when it is absent; the issue does not name the test file.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The outline tab's course end alert and certificate status alert ignore the learner's time zone preference. Their dates are formatted in the browser's time zone; every other date on the tab uses the preference. The cause is the one in #2148, which #2149 fixed for the sequence due dates.
Both versions of Learning are affected: the frontend-build and frontend-platform version under src/, and the frontend-base version under frontend-base/ on the frontend-base branch, where #2252 (open) ports the two alerts with the same reads.
[!NOTE]
This issue was written by Claude (Claude Code) and reviewed before posting.
Claude Plan
Mechanism
Read from the code at the linked commits; not reproduced in a browser.
-
Both alerts' hooks read
userTimezoneas a top-level key of the outline data:useCourseEndAlertanduseCertificateStatusAlert. The outline data has no such key (normalizeCourseHomeOutline): the outline response carriesuser_timezoneonly insidedates_widget(outline/serializers.py,outline/views.py). So each hook putsundefinedin its alert's payload. -
Each alert builds its format arguments as
userTimezone ? { timeZone: userTimezone } : {}(CourseEndAlert.jsx,CertificateStatusAlert.jsx), so its dates are formatted in the browser's time zone. -
The reads were right until #606 (
70e2aa02, 2021), which moved the tab's time zone reads to the course metadata. In these two hooks it tookuserTimezoneout of thedatesWidgetnesting and left the read on the outline data, as it did in the read #2148 describes:const { datesWidget: { courseDateBlocks, - userTimezone, }, + userTimezone, } = useModel('outline', courseId); -
The certificate status alert has a second fault. It spreads the format arguments onto its
FormattedMessage, which has notimeZoneprop, and the twoFormattedDateelements inside the message get none (CertificateStatusAlert.jsx). With a time zone in its payload, the alert would still format both dates in the browser's time zone. The spread has been there since #477 added the alert, so its dates have never used the preference.
Timeline
| When | Change | Course end alert | Certificate status alert |
|---|---|---|---|
| 2020-08-03 | #146 (314b82d0) adds the course end alert; its hook reads datesWidget.userTimezone from the outline model |
working | not there yet |
| 2021-06-10 | #477 (fab2da45) adds the certificate status alert; its hook reads datesWidget.userTimezone too, and the component spreads the time zone onto its FormattedMessage |
working | hook right, dates never get the time zone |
| 2021-09-03 | #606 (70e2aa02) moves the tab's time zone reads to the course metadata; in these two hooks it takes userTimezone out of the datesWidget nesting and leaves the read on the outline model |
broken from here | hook broken too |
| 2026-09-22 | #2093 (218c9dfb), part of the Redux to React Query migration, swaps useModel('outline', courseId) for useOutlineTabData(courseId, { enabled: false }).data |
broken, same read | broken, same read |
The outline model had no top-level userTimezone after #606: the store snapshot at that commit carries it only under courseHomeMeta, and #606 removed user_timezone from the outline test factory.
Where it shows
- Course end alert, shown to an enrolled learner in the 14 days before the course ends (
hooks.js). In the last day it reads "This course is ending {timeRemaining} at {courseEndTime}.", a date, a time and a time zone abbreviation. Before that it reads "This course is ending {timeRemaining} on {courseEndDate}.", a date only. - Certificate status alert, in the "earned but not available" status: "This course ends on {courseEndDateFormatted}. Final grades and any earned certificates are scheduled to be available after {certificateAvailableDate}.", both dates only.
- A date with no time differs between the two time zones only when they put the instant on different days.
Elsewhere on the tab
The other dates on the tab read userTimezone from the course metadata, which carries it (course_metadata/views.py, api.ts): the dates widget (CourseDates.jsx), the sequence due dates since #2149 (SequenceDueDate.tsx), the course start alert (CourseStartAlert.jsx) and the access expiration alert (hooks.ts).
#2148 said, from the code and not observed, that the course end alert shows the preference's time zone. It does not.
Fix
useCourseEndAlertanduseCertificateStatusAlertreaduserTimezonefromuseCourseHomeMeta(courseId, { enabled: false }).data, asCourseDates.jsxdoes.CertificateStatusAlert.jsxspreads the format arguments onto its twoFormattedDateelements in place of theFormattedMessage.- Tests: the outline suite gains a case for each alert under a course metadata response whose
user_timezoneputs the alert's date on a different day than the browser's time zone does, asserting the date in the preference's time zone, as #2149's case does for a sequence due date.
Acceptance
- With
user_timezonein the course metadata response, the course end alert's date and time are formatted in that time zone - With
user_timezonein the course metadata response, the certificate status alert's two dates are formatted in that time zone - With no
user_timezone, both alerts format their dates in the browser's time zone, as today
- Lingua principale
- JavaScript
- Stelle
- 71
- Fork
- 341
- Merge medio
- 4g 11h
- PR unite (30g)
- 17
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openedx/frontend-app-learning
-
Outline tab links to a hidden dates tabForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
openedx/frontend-app-learning#2250 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
openedx/frontend-app-learning#2147 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 94/100
openedx/frontend-app-learning#2119 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openedx/frontend-app-learning#2059 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
openedx/frontend-app-learning#2051 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di openedx/frontend-app-learning
Issue simili
-
Client execution contract accepts a grant the code never takesForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea: client enhancement priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
opensro-dev/opensro#3808 ·
I maintainer di solito rispondono entro 1 giorno
-
luciano_blocktronics: sysop chat status views are both keyed TL10 and use itemFormat, which a TextView ignoresForse già presa @Z3NMA l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NuSkooler/enigma-bbs#1058 ·
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
enhancement good first issue severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TMHSDigital/Static_Chess#163 ·
I maintainer di solito rispondono entro 1 giorno