[Feature:InstructorUI] Toggle date format#12844
Conversation
jndlansh
left a comment
There was a problem hiding this comment.
I think the changes do work as described.
Only the date format at Notification panel is the same, you have mentioned that. I am not sure if the maintainers want to leave it that way. We can address that too, if required.
Also, add the DB migration step in the PR description.
|
Thank you @jndlansh for feedback. I will add migration steps and try to resolve the notification panel date issue. Seems like it’s a python script from sbin folder. |
|
Hey @jndlansh, I checked the notification system, and it looks like the notification content is constructed as one full text string, like The full string is then saved in the notifications table under column content. I have included a screenshot for reference. A possible quick fix would be to make a database call to get the user’s preferred date format before running the However, this approach is still challenging because if the user changes their preferred date format later, existing notifications will remain in the old format. The change would only apply to notifications created after the preference update. Could you and the other mentors provide some guidance on the preferred approach here. So that I can take this forward. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12844 +/- ##
=========================================
Coverage 21.62% 21.62%
- Complexity 9824 9839 +15
=========================================
Files 268 268
Lines 36816 36848 +32
Branches 490 490
=========================================
+ Hits 7960 7967 +7
- Misses 28370 28395 +25
Partials 486 486
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Tag me anytime you want to run them again after making changes. |
Thank you @GarvitKhandelwal31. Will keep in mind next. I’ll start working on fixes. If you have any tips on fixing unit tests. Do share. |
I will check the failing results tomorrow. |
5302afa to
f8d7028
Compare
|
I checked the CI failures for PHP lint and unit tests. From what I understand, the existing test setup may not cover the feature I added yet. Could someone please help me confirm whether I need to update/add tests for this feature, or suggest the right direction to fix the failures? |
|
I removed few lines from phpstan-baseline.neon because the test were old according to the changes made in the DateTimeFormat.php under site/app/models directory, which resolves the php lint failures. However, php unit CI still fails along with other cypress tests. |
|
@GarvitKhandelwal31 Could you run the tests again? There is still a unit test failing, and I’d appreciate it if you could take a look when you get a chance. |
dagemcn
left a comment
There was a problem hiding this comment.
Functionality remains the same and changes look good! Good work here.
| 'preferred_given_name' => "", | ||
| 'preferred_family_name' => "", | ||
| 'preferred_given_name' => null, | ||
| 'preferred_family_name' => null, |
There was a problem hiding this comment.
Is this change required for "date format toggle" PR?
|
Question, is there a reason to not support date and time format? I think the wording of the UI is a little misleading if we don't support both. I think "Change date/time format" should be just "Change date format" and not display " @ 10:30 am" or " @ 10:30 " |
@IDzyre , I agree with you on the wording. I should change the UI text to just date format instead of date/time. However, there is one issue. The variables names used in the code can be misleading too. Should I address the variable naming in a seperate issue ? |
dagemcn
left a comment
There was a problem hiding this comment.
Comments related, also please address IDzyre's comment.
dagemcn
left a comment
There was a problem hiding this comment.
Please address IDzyre's other comment on line 165/166 of UserTester.php
|
removed the unnecessary changes in UserTester.php. Kindly review. |


Why is this Change Important & Necessary?
Closes #11751
Despite having multiple date/time formats (MDY, DMY, YMD) defined in the codebase, the site was hardcoded at
models/Config.phpto use YMD format.What is the New Behavior?
Users can now select their preferred date/time format from their profile settings page. The selected format is saved to the database and applied across the entire site. Except the notification banner (which I think is due to hardcoded date format)

Before: All dates displayed in YMD format.
After: Users can choose MDY, DMY, or YMD from their profile.
What steps should a reviewer take to reproduce or test the bug or new feature?
Note: Make sure your host files are synced with the vagrant VM before running these steps.
Database Migration:
UI Changes:
3. cd /usr/local/submitty/GIT_CHECKOUT/Submitty/site
4. submitty_install_site
Alternatively, run
submitty_installto apply all migrations and changes at onceWhat steps should a reviewer take to reproduce or test the bug or new feature?
Steps for migration?
Automated Testing & Documentation
No automated tests added. A new GitHub issue should be created to add Cypress tests for this feature.
Other information
date_formatcolumn to theuserstableYMD(ISO 8601 standard) matching current behavior