-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make date display consistently across manager components #16604
base: 3.x
Are you sure you want to change the base?
Conversation
19f9c2f
to
e54102d
Compare
@smg6511 In general I like the proposed idea, but I didn't like the implementation much, it seemed a bit complicated. Can you please check an updated version I pushed to my repo: theboxer@4133e16 and let me know your thoughts? The key changes would be:
|
@theboxer Thanks for going through it so thoroughly! I took an initial look and like what you did structure-wise. (I do sometimes try to do too much in some methods!) I do need to understand better how the use and implementation of services works. Anyway, let me pull this down and go over it more closely in the next few days or so. The one thing I see that I will probably argue is your reversion to Be back soon... |
I'm fine with using the |
@theboxer - Quick question: I've not pulled down a fork of a fork before; what's the best way of going about that? To this point I've used Github Desktop for all things modx git, but realize this may require some command line actions. |
@smg6511 — You should be able to add the fork as a new remote in your existing repository. I imagine GH Desktop has a feature for adding a remote? |
Ok, so basically fork John's revo repo is what you're suggesting, right? |
No, you just add his fork as a remote to your local git repo. |
@smg6511 for cli command, it'd be |
Ok, I've pulled down your changes and am giving them a run-through. I'd referenced the incorrect format above when making the case for using Anyway, I'll be back with any other comments in the next day or so... |
@theboxer @opengeek @rthrash - (re John's updated version) Another thing I noticed is the use of typed properties. I'd love to make use of this feature, but we'd need to bring up the required modx php version to 7.4. Currently we're stating 7.2.5. Is there movement toward upping the required php version for the next (or the 3.1) release? |
@smg6511 Revo 3.x already requires 7.4 (https://github.com/modxcms/revolution/blob/3.x/composer.json#L52)
Like I said, I have no issues using the |
@theboxer - Ok, no problem putting the use of BTW, I think everything's looking great otherwise. I have a couple small additions/tweaks based on your updates which I have incorporated on a new branch:
On the php version, the modx.com/download page will need to be updated—it still claims 7.2.5 is the required version; the same goes for the Docs. Also, the phpcs.xml file needs updating as well (which I can do). |
@smg6511 will you push all the stuff here? |
Adds a new centralized formatting class for datetime data, adjusting various classes to make use of the new formatters.
Applied formatter to system settings processor and made a few other corrections to previously-committed code.
Should have included this with the last commit
Include empty date display value in early return
Applies formatter to this object type
(Finding areas I'd missed updating in earlier commits)
Add/tweak method documentation; make nullable string more explicit in method signatures
Applies new modManagerDateFormatter to Context settings
5baa17d
to
6150494
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.x #16604 +/- ##
============================================
+ Coverage 21.47% 21.53% +0.06%
- Complexity 10652 10718 +66
============================================
Files 561 565 +4
Lines 32268 32521 +253
============================================
+ Hits 6929 7005 +76
- Misses 25339 25516 +177
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@theboxer - Ok, I think this is all set to do a final run-through. In the end, we just need to be sure that this does not end up in a 3.0.x backport, as the php version requirement is still too low there for the use of typed props (used in the Formatter). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one more think I want to mention, I notice in same cases we're switching from JS doing the formatting to the PHP doing it, this will result in different value getting displayed to the user (if the user is in a different time zone than the server) and it also means that the JS has a different value for other functions that are getting called. I'm not sure if this is or isn't an issue, but wanted to mention it :)
Make requested changes and add a few more prop/method type declarations
Implement requested change missed in previous commit
… into 3.x-issue-14961
I don't think this should be a problem. All the core dates are stored as unix timestamps and users have control over the offset via the system setting. So long as we're consistently calculating and formatting dates on just one side of the equation (back end/php in our case), I think we should be fine. If there's a worry here, I suppose the release notes could alert folks that, potentially, with this update datetimes displayed in the back end may be different than expected if a user's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you!
If we have depended on the JS showing these in the proper timezone in the browser without needing server_offset_time to be managed before now, then this could be a problem. |
@opengeek I did a quick run through of the changed js to be sure; I didn't see any issues when simulating different time zones. By and large the date formatting was being done in php before this PR—just in an inconsistent ways across the board—and we didn't change much in the js in that regard. |
I'm fine with merging this one :) |
This implementation still seems overly complicated to me. I don't understand the need for all these settings and a formatting class. PHP provides date formatting that should be sufficient to handle this. |
@smg6511, can you elaborate on the necessity for the Formatter class? I.e. what does it do that can't be done natively with PHP? What else does it do? I'm not suggesting it's the wrong path. I'm just trying to understand it clearly and your intention. |
@opengeek @jaygilmore - In a nutshell, the primary reasons for/advantages of the approach taken are:
All that's not to say it can't be improved further ;-) |
What does it do?
Why is it needed?
The manager UI is inconsistent in its formatting of dates and times. This PR consolidates the formatting logic in one place and applies it to every component that displays a date (unless I've overlooked something).
How to test
/_build/transport.core.php
) then a reinstall (upgrade) via/setup
.manager_date_format
andmanager_time_format
, as well as amanager_datetime_separator
in the system settings.Related issue(s)/PR(s)
Resolves #14961.
Resolves #16512.