The compact date/time range formatter module builds on the core date & time range module, by providing the ability to display date/time range fields in a more compact form, by omitting the month or year where it would be duplicated.
Examples:
24–25 January 2017 (range is within a single month)
29 January–3 February 2017 (range is within a single year)
9:00am–4:30pm, 1 April 2017 (range is within a single day)
This module defines a new configuration entity, date_range_format
, to store patterns for date range formats, in a similar way to Drupal's core date formats. Variations can be configured for use where the day, month or year is the same for both start and end date.
Both date-only and date & time ranges are supported.
Project page
https://www.drupal.org/project/daterange_compact
Git clone command
git clone --branch 8.x-1.x https://git.drupal.org/project/daterange_compact.git
Manual reviews of other projects
https://www.drupal.org/node/2874030#comment-12068126
https://www.drupal.org/node/2867080#comment-12067540
https://www.drupal.org/node/2871500#comment-12067506
Comments
Comment #2
PA robot CreditAttribution: PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #3
heddnNot at all related to the code, but a suggestion is to rename the module from daterange_compact to daterange_formatters. Or add it as a patch to https://www.drupal.org/project/datetime_extras. Naming is hard, but to think that only compact formatters will ever exist for daterange seems odd.
Code review:
private function dateTimeExamples(DateRangeFormatInterface $format) {
For my theoretic vulnerability, I'm marking as needs works.
Comment #4
erik.erskine CreditAttribution: erik.erskine commentedheddn, thanks very much for your review.
Calling this module "daterange_formatters" sounds a bit too broad to me. I've never intended it to become a suite of many possible formatters, but rather addresses a single problem.
I looked at https://www.drupal.org/project/datetime_extras - perhaps it would be a good place for this. I notice that one of the aims is to help mentor new contributors, and get code to be a good enough standard for core. That would be valuable for me so I'm open to adding it there.
I couldn't see any plan for a stable release though, so in the meantime have submitted this module as a discreet piece of functionality in order to be reviewed.
Not sure I follow - would `dateTimeExamples` be a function inside DateRangeFormatter (the service)?
It's hard to know where to put these. They are intended to make the DateRangeFormatListBuilder more useful - showing concrete examples rather than the pattern itself. Core does this for date formats, but is slightly flawed if the current date happens to be ambiguous (eg 1/1). We also need to show a variety of ranges (example of same day, same month, same year etc) - hence the hardcoded values.
You're right, this is a potential vulnerability.
Core's main date formatter doesn't allow any HTML - it always escapes the output. You can't put a span in the date format. The intention here was to follow suit, so I have changed the field formatter to escape the output by using `#plain_text` instead of `#markup` which should remove the vulnerability.
Comment #5
John Pitcairn CreditAttribution: John Pitcairn commentedIn my opinion this formatter would be a useful addition to the core date module.
That said, getting this released as a full project with security coverage will be a lot easier than getting it into core, so let's focus on that. I'm adding it to a soon-to-be-live website and will provide further feedback or RTBC soon.
Comment #6
John Pitcairn CreditAttribution: John Pitcairn commentedI think ultimately this would be best in datetime_extras, and we push for a stable release with security support there. I'll open issues there about that. Note there is an issue open there about a possibly similar formatter, though that appears to be buggy and progress looks stalled. #2834016: Add 'Compact' datetime range formatter
I agree with the protected vs private comment from @heddn, and have opened an issue in your sandbox, with patch. #2887922: Use protected not private to allow extending classes
Finally, this module appears to be well coded and with the potential security issue removed I see no reason why you shouldn't be allowed to make a full release with security support.
Comment #7
lias CreditAttribution: lias commentedIs there any movement on the review of this module?
Use of this module would be very helpful for those of us adopting Drupal 8 for new sites using date range as it stands now for events. This module seems like a happy medium to move forward using Date in core rather than using an external FullCalendar type of solution.
Thanks for an update ia
Comment #8
apadernoThank you for your contribution!
I am going to update your account so you can opt into security advisory coverage now.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.
Comment #9
apaderno