Sertion / vscode-gitblame

Visual Studio Code Extension - See Git Blame info in status bar.
https://marketplace.visualstudio.com/items/waderyan.gitblame
MIT License
72 stars 31 forks source link

Improve time ago estimate #83

Closed BenLanglois closed 4 years ago

BenLanglois commented 4 years ago

Overview

time.ago uses larger units of time for time differences smaller than one unit. For example, if a commit was made 7 months ago, time.ago reports this as "1 year ago". I think that smaller units of time would be more useful, i.e. "7 months ago".

My proposed solution is to show smaller units when they are less than their roll-over value (60 minutes, 24 hours, 31 days, or 12 months). Once the roll-over value is reached the larger unit is used. For example, 11 months is reported as "11 months ago" and 12 months is reported as "1 year ago".

Changes made in this PR

Possible issue

Time differences are rounded up before they are compared to their roll-over value. For example, 11.6 months is rounded up to 12 months and is therefore reported as "1 year ago". Maybe it would be better to display this as "11 months ago" or "12 months ago". I personally prefer "1 year ago" but I'm open to other opinions.

Sertion commented 4 years ago

Hey Ben. Thank you for the pull request!

Looks good to me. Will try to get a new version out sometime this coming week.