Skip to content

Add age field to pr list / pr view#6085

Merged
vilmibm merged 2 commits intocli:trunkfrom
satotake:add-age-to-pr
Aug 23, 2022
Merged

Add age field to pr list / pr view#6085
vilmibm merged 2 commits intocli:trunkfrom
satotake:add-age-to-pr

Conversation

@satotake
Copy link
Contributor

Fixes #6080

pr list and pr view do not show PR's age for now.
On the other hand, issue list and issue view show the fuzzy age.
This PR added the age field to pr list and pr view in the similar way to issue.

@satotake satotake requested a review from a team as a code owner August 16, 2022 17:11
@satotake satotake requested review from vilmibm and removed request for a team August 16, 2022 17:11
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Aug 16, 2022
@vilmibm vilmibm self-assigned this Aug 16, 2022
@LangLangBart
Copy link

LangLangBart commented Aug 18, 2022

(no maintainer, just a user who happened to stumble across this PR).
Thank you for fixing the problem. I tested the patch briefly and it worked fine for me.

If it's a low hanging fruit, could it be done the same as the GitHub web interface, rendering a timestamp as relative to now for 1 month and after that formats as timestamp "2 Jan"?
PS: ... and after more than 1 year as "2 Jan 2006"

@satotake
Copy link
Contributor Author

@LangLangBart
gh still have the formatter which is similar to but slightly different from what you described.

10h         
3d          
3d          
25d         
Jul  6, 2022

It is not so hard to define formatter which is strictly same as the web view.
But I am hesitant to implement it here because we need to change the current formatter or create yet another.

Could you have any idea @vilmibm ?

@vilmibm
Copy link
Contributor

vilmibm commented Aug 23, 2022

future TODO: both pr list and issue list should have a Now function injected to avoid the regular expression stuff in tests.

@vilmibm vilmibm merged commit 1da31c8 into cli:trunk Aug 23, 2022
satotake added a commit to satotake/cli that referenced this pull request Aug 24, 2022
following cli#6085

* Inject fake `Now` function to tests of `issue list` / `pr list`
* Remove `regexp` from the tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make it easier to see when a PR was created

4 participants