Problem/Motivation
When formatting the time for output, the minutes are only shown if it's the top of the hour, when it should be the opposite. E.g., if it's 9:32 am, "9 a.m." is output. If it's 9:00 am, "9:00 am" is output.
This is due to the logic here which is reversed:
if ($date->format('i')) {
// Don't display the minutes if it's the top of the hour.
$ap_time_string = $date->format('g a');
}
else {
$ap_time_string = $date->format('g:i a');
}
Steps to reproduce
- Setup a content type with a date field and configure it to use the AP Style Date formatter
- Add a node and set that date field to a time that is NOT the top of the hour
- View the node and observe that the minutes are not shown, when they should be
Proposed resolution
Fix the logic.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3224269-fix-for-current-release.patch | 480 bytes | bkosborne |
| #6 | 3224269-fix-for-dev.patch | 488 bytes | bkosborne |
Issue fork date_ap_style-3224269
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
shelaneComment #6
bkosborneThanks for the quick commit, but looks like I made an error! It should be '00' and not '0'. Sorry about that. I tried creating another merge request, but for some reason the new branch is not up to date with 8.x-1.x, so here's a traditional patch to fix 8.x-1.x that should be committed, and here's another patch that fixes version 1.2 (for those that want to use the patch with 1.2).
Comment #8
shelaneI've committed it, but you know that you are still a maintainer on the project. ;-)
Comment #9
bkosbornehah! forgot about that. thanks!