Skip to content
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

Support for reading time ranges #20

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

GeneralAntilles
Copy link

Adds support for reading time estimate ranges (e.g., "5–7 minutes", "19 to 23 minutes").

Two new settings:

  • estimate_range [default: 15]: The percentage range for the reading time range estimate (e.g., ±15%).
  • range_str [default: –]: The string that joins the low and high estimates (e.g., "–", "-", " to ").

Two new format variables:

  • {minutes_short_range}: Same as {minutes_short_count} but gives a range joined by range_str (e.g. "11–15")
  • {minutes_long_range}: Same as {minutes_long_count} but gives a range joined by range_str (e.g., "05 to 07")

The estimate is calculated as the normal reading time estimate ± the estimate_range percent, so a 15% range would give you reading time minus 15% for the low estimate and plus 15% for the high estimate.

If the range has the same values for the low and high estimate it will return the count instead (e.g,. "1–1" returns "1") and will appropriately match the {minutes_text}. If the range floors out at 0, then also return the count instead.

I did not implement any support for seconds here, as it added complexity for spurious precision of dubious utility—"13 minutes 16 seconds to 17 minutes 56 seconds" doesn't add much over (13 to 18 minutes).

Adds range settings for reading time estimate ranges. estimate_range to
control the range percentage ± and range_str for the string to combine the
low and high estimates.
Depending on the reading time estimate and the estimate range
percentage, we may end up with identical high and low estimates or
flooring out at zero minutes. Test for these cases and return a range
that makes sense.
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.

None yet

1 participant