Skip to content

[Bugfix:Forum] Fix date crash (#12945)#13022

Merged
bmcutler merged 6 commits into
Submitty:mainfrom
parthrajsinghbhati:fix/forum-date-format
Jul 13, 2026
Merged

[Bugfix:Forum] Fix date crash (#12945)#13022
bmcutler merged 6 commits into
Submitty:mainfrom
parthrajsinghbhati:fix/forum-date-format

Conversation

@parthrajsinghbhati

Copy link
Copy Markdown
Contributor

Why is this Change Important & Necessary?

Fixes #12945

When a user sets their date format preference to MDY or DMY, clicking
on a discussion forum thread caused a server crash due to Twig's
date() filter attempting to parse a user-formatted display string
(e.g., 2018/23/5 8:49 PM) as a date, which PHP cannot reliably parse.

What is the New Behavior?

  • Forum threads now load correctly for all date format preferences.
  • A raw ISO timestamp (post_date_raw) is passed alongside the display
    string and used for internal date comparisons in CreatePost.twig.
  • MDY and DMY forum date formats now display in conventional order
    (e.g., 23/5/2018 instead of 2018/23/5), consistent with all
    other format keys in DateTimeFormat.php.

What steps should a reviewer take to reproduce or test the bug or new feature?

  1. Log in as any user
  2. Go to My Profile → change Date Format to DMY or MDY
  3. Navigate to Discussion Forum → click on any thread
  4. Verify no server error occurs and dates display in correct order

Automated Testing & Documentation

No automated tests added. A new GitHub issue should be filed to add
forum date format tests.

Other information

No breaking changes. No migrations required. No security concerns.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.09%. Comparing base (09ce4a3) to head (8b3bd59).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #13022   +/-   ##
=========================================
  Coverage     21.09%   21.09%           
  Complexity    10115    10115           
=========================================
  Files           279      279           
  Lines         38167    38167           
  Branches        585      585           
=========================================
  Hits           8051     8051           
  Misses        29544    29544           
  Partials        572      572           
Flag Coverage Δ
autograder 21.16% <ø> (ø)
js 1.76% <ø> (ø)
migrator 100.00% <ø> (ø)
php 20.19% <ø> (ø)
python_submitty_utils 79.83% <ø> (ø)
submitty_daemon_jobs 91.13% <ø> (ø)
vue 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread site/app/views/forum/ForumThreadView.php Outdated
@parthrajsinghbhati

Copy link
Copy Markdown
Contributor Author

@jndlansh I have made the changes and pushed them. Can you review it and let me know if something else is needed?

Comment thread site/app/templates/forum/CreatePost.twig Outdated

@jndlansh jndlansh 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.

Add a screen-recording/screenshots of the changes made on branch against main

@parthrajsinghbhati

parthrajsinghbhati commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Add a screen-recording/screenshots of the changes made on branch against main

@jndlansh I did not understand what is needed here, the code changes or the functionality to be shown before and after the changes in the website

@jndlansh

jndlansh commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

The UI changes, showing the error does not happen on your branch

@parthrajsinghbhati

Copy link
Copy Markdown
Contributor Author
changing-date.mp4
Unread.Thread.mov

@jndlansh Uploaded the video where I have made changes and showed the correct working of the website

@dagemcn dagemcn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changes here look good. I was able to verify the forum still works correctly, display the M/D/Y and D/M/Y formats correctly. I also tested the functionality of the forum on both different settings and was able to make posts, reply, and attach images with no problem. Good work here!

@github-project-automation github-project-automation Bot moved this from Seeking Reviewer to Awaiting Maintainer Review in Submitty Development Jul 13, 2026

@jndlansh jndlansh 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.

I approve too.
The changes are good enough and the solve the issue.

@bmcutler
bmcutler merged commit 16b67e9 into Submitty:main Jul 13, 2026
52 of 53 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting Maintainer Review to Done in Submitty Development Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Different date formats break certain functionality

4 participants