Repository navigation
Premium Analytics: name the selected period on the date range control - #51817
Conversation
a whole calendar month or year reads as itself; anything else stays minimal
the exact dates move to its tooltip; the header subtitle no longer carries them
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Premium Analytics plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryCoverage changed in 4 files.
|
Proposed changes
July 2026, a whole calendar year reads2026. Every other range keeps the shortest form it already had.#51707removed the section header subtitle, so this is now the only place they are readable without opening the calendar.formatDateRangeNaturalinpackages/formatters. Its two collapses format a single date rather than a range, soelideRangeand its CLDR probes are not involved; everything else falls through toformatDateRangeMinimalunchanged.monthYear, derived from the site's owndate_formatby awithoutDaytransform mirroring the existingwithoutYear:F j, Y→F Y,Y-m-d→Y-m,j \d\e F \d\e Y→F \d\e Y. The weekday goes with the day, and an ordinal suffix (jS) goes with the day it trails.Both collapses keep the year, including in the current one. This label is the only thing naming the period on the control, so a bare
Marchwould not say which March.Both call sites of
getCustomTriggerLabelmove together, since the panel's measuring probe has to measure the string the trigger is actually showing.Two decisions worth flagging:
Custom, and a tooltip there would put the preset's range on a control that is not showing it (WOOA7S-1936).aria-label. The button already has visible text, unlike the interval glyph, so anaria-labelcarrying the exact range would replace the accessible name and break its correspondence with the visible label.Tooltipsuppliesaria-describedby, which is the right role for a complement.A range covering two whole months (
Mar 1 – Apr 30) does not collapse: it names no single period, and the spec asks for the shortest form rather than an invented one.Related product discussion/links
March 30was a typo, the year stays in the current year too, and only whole months and whole years collapse.Does this pull request change what data or activity we track or use?
No.
Testing instructions
Build the dashboard:
jetpack build --deps packages/premium-analytics.Open any analytics page.
The steps below assume the site's date format (Settings → General → Date format) is the English default,
F j, Y; the last step covers a different one.Open the custom range picker, select the first and last day of a past month, and Apply. The trigger reads the month and its year, for example
July 2026.July 1 – 31, 2026.Last 30 days. The trigger goes back to readingCustom, with no tooltip.End. Focus lands on the trigger, and the arrow keys still move along the row.d/m/Yand repeat the first step. The month reads07/2026, taken from the site's own format rather than an English one.Storybook:
Packages/Premium Analytics/UI/DateRangePopover→CustomWholeMonth.