Support for reading time ranges#20
Open
GeneralAntilles wants to merge 5 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 byrange_str(e.g. "11–15"){minutes_long_range}: Same as{minutes_long_count}but gives a range joined byrange_str(e.g., "05 to 07")The estimate is calculated as the normal reading time estimate ± the
estimate_rangepercent, 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).