Skip to content

Name the exported PDF after the site and reporting period - #13765

Merged
zutigrm merged 6 commits into
developfrom
enhancement/13216-pdf-filename
Oct 9, 2026
Merged

zutigrm merged 6 commits into
developfrom
enhancement/13216-pdf-filename

Conversation

@mehidi258

Copy link
Copy Markdown
Collaborator

Summary

Related issue(s):

Relevant technical choices

  • This is the first use of Intl.DateTimeFormat.prototype.formatRange in the codebase, so pdf-utils.ts adds /// <reference lib="es2021.intl" /> — tsconfig targets es5, which leaves it untyped. All @wordpress/browserslist-config targets support it.
  • getSiteHost gained an optional fallback parameter, so the filename can fall back to report for an unparseable URL while the header keeps showing the raw value as before.
  • Per AC8, reserved characters are removed from the localized date too, so locales that write dates with / lose the separators, e.g. zh-CN 2026/3/1 – 2026/3/7 becomes 202631 – 202637.

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the PDF export filename generation logic to use localized date ranges and site hosts instead of slugified strings. It moves the getSiteHost utility to a shared location, updates PDFExportOrchestrator and PDFHeader to use the new implementation, and adds comprehensive test coverage. Feedback was provided to add a defensive fallback for Intl.DateTimeFormat.prototype.formatRange to prevent runtime errors in older browsers that do not support this ES2021 API.

Comment thread assets/js/components/pdf-export/pdf-utils.ts Outdated
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🤖 This comment is automatically updated by CI workflows. Each section is managed independently.

📚 Storybook for a7f6604:

  • Storybook has been deleted.

📦 Build files for a7f6604:

  • Build files have been deleted.

🎭 Playwright reports for a7f6604:

🖼️ VRT report for a7f6604:

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 3.39 MB

ℹ️ View Unchanged
Filename Size Change
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.css 124 B 0 B
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/reader-revenue-manager/block-editor-plugin/index.js 46.5 kB 0 B
dist/assets/blocks/reader-revenue-manager/common/editor-styles.css 307 B 0 B
dist/assets/blocks/reader-revenue-manager/common/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/reader-revenue-manager/contribute-with-google/index.js 7.08 kB 0 B
dist/assets/blocks/reader-revenue-manager/contribute-with-google/non-site-kit-user.js 6.29 kB 0 B
dist/assets/blocks/reader-revenue-manager/subscribe-with-google/index.js 7.09 kB 0 B
dist/assets/blocks/reader-revenue-manager/subscribe-with-google/non-site-kit-user.js 6.29 kB 0 B
dist/assets/blocks/sign-in-with-google/editor-styles.css 84 B 0 B
dist/assets/blocks/sign-in-with-google/editor-styles.js 0 B 0 B 🆕
dist/assets/blocks/sign-in-with-google/index.js 18.5 kB 0 B
dist/assets/css/googlesitekit-admin-css-********************.min.css 76.9 kB 0 B
dist/assets/css/googlesitekit-adminbar-css-********************.min.css 12.7 kB 0 B
dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 851 B 0 B
dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 8.9 kB 0 B
dist/assets/js/20-********************.js 1.03 kB 0 B
dist/assets/js/22-********************.js 2.41 kB 0 B
dist/assets/js/212-********************.js 2.26 kB 0 B
dist/assets/js/315-********************.js 3.08 kB 0 B
dist/assets/js/397-********************.js 477 kB 0 B
dist/assets/js/492-********************.js 970 B 0 B
dist/assets/js/603-********************.js 52.7 kB 0 B
dist/assets/js/741-********************.js 3.84 kB 0 B
dist/assets/js/792-********************.js 101 kB 0 B
dist/assets/js/959-********************.js 3 kB 0 B
dist/assets/js/analytics-advanced-tracking-********************.js 428 B 0 B
dist/assets/js/googlesitekit-activation-********************.js 30.7 kB +52 B (+0.17%)
dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 67.9 kB +48 B (+0.07%)
dist/assets/js/googlesitekit-admin-pointers-tracking-********************.js 6.04 kB +46 B (+0.77%)
dist/assets/js/googlesitekit-adminbar-********************.js 37.5 kB +54 B (+0.14%)
dist/assets/js/googlesitekit-api-********************.js 9.09 kB +47 B (+0.52%)
dist/assets/js/googlesitekit-block-tracking-********************.js 6.25 kB +42 B (+0.68%)
dist/assets/js/googlesitekit-components-********************.js 6.92 kB 0 B
dist/assets/js/googlesitekit-consent-mode-********************.js 25.5 kB 0 B
dist/assets/js/googlesitekit-data-********************.js 1.83 kB 0 B
dist/assets/js/googlesitekit-datastore-forms-********************.js 7.88 kB +45 B (+0.57%)
dist/assets/js/googlesitekit-datastore-location-********************.js 1.6 kB 0 B
dist/assets/js/googlesitekit-datastore-pdf-********************.js 1.22 kB 0 B
dist/assets/js/googlesitekit-datastore-site-********************.js 20.8 kB +49 B (+0.24%)
dist/assets/js/googlesitekit-datastore-ui-********************.js 8.05 kB +46 B (+0.57%)
dist/assets/js/googlesitekit-datastore-user-********************.js 25.9 kB +48 B (+0.19%)
dist/assets/js/googlesitekit-entity-dashboard-********************.js 88.2 kB +49 B (+0.06%)
dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 1.27 kB 0 B
dist/assets/js/googlesitekit-events-provider-content-events-********************.js 3.16 kB 0 B
dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 651 B 0 B
dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 1.24 kB 0 B
dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 1.26 kB 0 B
dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 1.28 kB 0 B
dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 1.35 kB 0 B
dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 895 B 0 B
dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 1.3 kB 0 B
dist/assets/js/googlesitekit-feature-discovery-********************.js 15.4 kB +45 B (+0.29%)
dist/assets/js/googlesitekit-features-********************.js 64 kB +50 B (+0.08%)
dist/assets/js/googlesitekit-features-badge-********************.js 835 B 0 B
dist/assets/js/googlesitekit-i18n-********************.js 4.43 kB 0 B
dist/assets/js/googlesitekit-intents-********************.js 8.72 kB +45 B (+0.52%)
dist/assets/js/googlesitekit-key-metrics-setup-********************.js 63 kB +44 B (+0.07%)
dist/assets/js/googlesitekit-main-dashboard-********************.js 221 kB +29 B (+0.01%)
dist/assets/js/googlesitekit-metric-selection-********************.js 67.3 kB +42 B (+0.06%)
dist/assets/js/googlesitekit-modules-********************.js 29.7 kB +44 B (+0.15%)
dist/assets/js/googlesitekit-modules-ads-********************.js 58.5 kB +50 B (+0.09%)
dist/assets/js/googlesitekit-modules-adsense-********************.js 152 kB +45 B (+0.03%)
dist/assets/js/googlesitekit-modules-analytics-4-********************.js 298 kB +45 B (+0.02%)
dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 30.9 kB +51 B (+0.17%)
dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 136 kB +47 B (+0.03%)
dist/assets/js/googlesitekit-modules-search-console-********************.js 78.3 kB +48 B (+0.06%)
dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 39.6 kB +45 B (+0.11%)
dist/assets/js/googlesitekit-modules-tagmanager-********************.js 33.7 kB +43 B (+0.13%)
dist/assets/js/googlesitekit-notifications-********************.js 95.2 kB +51 B (+0.05%)
dist/assets/js/googlesitekit-polyfills-********************.js 227 B 0 B
dist/assets/js/googlesitekit-settings-********************.js 88.3 kB +42 B (+0.05%)
dist/assets/js/googlesitekit-splash-********************.js 79.4 kB +47 B (+0.06%)
dist/assets/js/googlesitekit-user-input-********************.js 58.8 kB +50 B (+0.09%)
dist/assets/js/googlesitekit-vendor-********************.js 314 kB 0 B
dist/assets/js/googlesitekit-vendor-lazy-pdf-********************.js 24.6 kB -56 B (-0.23%)
dist/assets/js/googlesitekit-widgets-********************.js 185 kB +53 B (+0.03%)
dist/assets/js/googlesitekit-wp-dashboard-********************.js 46 kB +44 B (+0.1%)
dist/assets/js/runtime-********************.js 1.94 kB +1 B (+0.05%)
dist/assets/js/sign-in-with-google-********************.js 1.35 kB 0 B

compressed-size-action

@zutigrm zutigrm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mehidi258 nice work. I left you some comments, let me know what you think

Comment thread assets/js/components/pdf-export/pdf-utils.ts Outdated
Comment thread assets/js/components/pdf-export/pdf-utils.ts Outdated
Comment thread assets/js/components/pdf-export/pdf-utils.ts Outdated
Comment thread assets/js/components/pdf-export/pdf-utils.ts Outdated
Comment thread assets/js/components/pdf-export/pdf-utils.ts Outdated
Comment thread assets/js/components/pdf-export/pdf-utils.test.ts Outdated
@mehidi258

Copy link
Copy Markdown
Collaborator Author

Thanks @mehidi258 nice work. I left you some comments, let me know what you think

Thanks @zutigrm for the feedbacks, i have addressed all. Passing to you for verify.

@zutigrm

zutigrm commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Thanks @mehidi, there are some merge conflicts that need ti be resolved

@mehidi258

Copy link
Copy Markdown
Collaborator Author

Thanks @mehidi, there are some merge conflicts that need ti be resolved

Thanks @zutigrm Conflicts has been resolved.

@zutigrm
zutigrm merged commit b767aa3 into develop Oct 9, 2026
37 of 38 checks passed
@zutigrm
zutigrm deleted the enhancement/13216-pdf-filename branch October 9, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the PDF Filename

2 participants