-
Notifications
You must be signed in to change notification settings - Fork 2
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
DOC-798 Add extension to calculate end-of-life date #92
Conversation
✅ Deploy Preview for docs-extensions-and-macros ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -6,6 +6,7 @@ nav: | |||
- modules/ROOT/nav.adoc | |||
asciidoc: | |||
attributes: | |||
page-release-date: 2024-03-01 |
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.
Consider using ISO 8601 dates to avoid problems with timezones.
Example date in ISO 8601 "2025-01-14T10:00:00Z" -> 10:00 UTC
extensions/util/calculate-eol.js
Outdated
weeksBeforeEOL.setDate(weeksBeforeEOL.getDate() - warningWeeks * 7); | ||
|
||
// Determine if the current date falls within warning or post-EoL | ||
const today = new Date(); |
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.
Using this method without setting a timezone can lead to discrepancies depending on where the server is located.
Consider doing something like this to make sure that it's always executed in the same timezone.
const timeZone = 'UTC';
const now = new Date();
const formattedDate = new Intl.DateTimeFormat('en-US', {
timeZone,
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
}).format(now);
You can possibly extend this to announcement banners and how long a beta is up too and be mindful of timezones. Either force it use UTC or bay area timezone ("America/Los_Angeles") |
This PR introduces an extension for managing the lifecycle of documentation versions. The extension calculates and attaches metadata about the end-of-life (EoL) status of pages based on the
page-release-date
attribute of the component version and customizable configuration settings for the extension. The resulting metadata can be used in UI templates to display banners or messages about nearing or past EoL statuses. See redpanda-data/docs-ui#242Adds the following attributes to pages:
page-is-nearing-eol
: Indicates if the page is within the warning period before EoL. Calculated using(page-release-date + supported_months) - warning_weeks
in https://github.com/redpanda-data/docs-extensions-and-macros/pull/92/files#diff-593ab60cae40c90a344cd9b8470d5b0cf45e558aee684093cbb7c92151d66589.page-is-past-eol
: Indicates if the page has passed its EoL. Calculated usingtoday > (page-release-date + supported_months)
in https://github.com/redpanda-data/docs-extensions-and-macros/pull/92/files#diff-593ab60cae40c90a344cd9b8470d5b0cf45e558aee684093cbb7c92151d66589.page-eol-date
: The calculated EoL date in a human-readable format, such as "March 1, 2025". See https://github.com/redpanda-data/docs-extensions-and-macros/pull/92/files#diff-593ab60cae40c90a344cd9b8470d5b0cf45e558aee684093cbb7c92151d66589page-eol-doc
: A URL to the policy for supported versions. Defined in the extension config.page-upgrade-doc
: An Antora resource ID to a doc containing upgrade instructions. Defined in the extension config.Usage
antora.yml
for versioned components, add the release date in the format YYYY-MM-DD.For example:
supported_months
(how long the version is supported) andwarning_weeks
(how long before the EoL date to display the banner). Both of these configs have defaults of 12 and 6, respectively.Example attributes for a page whose doc version with publish-date 2024-03-01:
Testing
Edit the extension configuration locally in
local-antora-playbook.yml
and check the output here: https://deploy-preview-92--docs-extensions-and-macros.netlify.app/preview/test/#end-of-life-attributes