instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.52k stars 2.45k forks source link

"Jump to Today" doesn't work if dates are in the future - SyllabusBehaviors.js #2066

Closed dtod closed 2 years ago

dtod commented 2 years ago

Summary:

On the Syllabus page, "Jump to Today" does not work if there are no dates on assignments or if assignments are in the future

Steps to reproduce:

  1. Add assignments with due dates in the future
  2. Edit the Syllabus and add significant content. Save.
  3. Click the Jump to Today link

Expected behavior:

Jump to the first row of the assignments table

Actual behavior:

Does not jump

Additional notes:

I think the problem is on line 176 of SyllabusBehaviors.js where the code sets a value for $lastBefore if it has not been set. However, the code on this line sets the variable to a row object rather than a date string. I suspect the correct code would be:

if (!$lastBefore) $lastBefore = $('tr.date:first').find('.day_date').attr('data-date')

dtod commented 2 years ago

See https://github.com/instructure/canvas-lms/commit/415ed618b5434253f3effc58f06c93a8df7a6b4a