From 94c660311ddd0b2e063f520e027b4096e1e84666 Mon Sep 17 00:00:00 2001 From: Ronnie Smith Date: Sat, 6 Apr 2024 15:56:06 -0700 Subject: [PATCH] try and add docs for date format, use lowerwcase relative --- docs/data/schemas/defaults.yaml | 19 +++++++++++++++++++ ui/components/issue/issue.go | 2 +- ui/components/pr/pr.go | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/data/schemas/defaults.yaml b/docs/data/schemas/defaults.yaml index 080da25e..f0ea3ddf 100644 --- a/docs/data/schemas/defaults.yaml +++ b/docs/data/schemas/defaults.yaml @@ -15,6 +15,7 @@ schematize: - Only fetch 20 PRs and issues at a time for each section. - Display the PRs view when the dashboard loads. - Refetch PRs and issues for each section every 30 minutes. + - Display dates using relative values. For more details on the default layouts, see the documentation for [sref:PR] and [sref:issue] layout definitions. @@ -154,6 +155,24 @@ properties: type: integer minimum: 1 default: 30 + dateFormat: + title: Date format + description: Specifies how dates are formatted. + schematize: + weight: 5 + details: | + This setting defines how dates are formatted. The format can be either be "relative" or a + [go time format]. + + By default, the format is "relative" which fits just inside the default column width of + updated at in the issues and pull request layouts. + + You may need to adjust the layout column width depending on your format. + + [go time format]: https://pkg.go.dev/time#pkg-constants + type: integer + minimum: 1 + default: 30 view: title: Default View description: Specifies whether the dashboard should display the PRs or Issues view on load. diff --git a/ui/components/issue/issue.go b/ui/components/issue/issue.go index 12246187..0f93b578 100644 --- a/ui/components/issue/issue.go +++ b/ui/components/issue/issue.go @@ -38,7 +38,7 @@ func (issue *Issue) renderUpdateAt() string { timeFormat := issue.Ctx.Config.Defaults.DateFormat updatedAtOutput := "" - if timeFormat == "" || timeFormat == "RELATIVE" { + if timeFormat == "" || timeFormat == "relative" { updatedAtOutput = utils.TimeElapsed(issue.Data.UpdatedAt) } else { updatedAtOutput = issue.Data.UpdatedAt.Format(timeFormat) diff --git a/ui/components/pr/pr.go b/ui/components/pr/pr.go index 83aa57cf..4a10882d 100644 --- a/ui/components/pr/pr.go +++ b/ui/components/pr/pr.go @@ -203,7 +203,7 @@ func (pr *PullRequest) renderUpdateAt() string { timeFormat := pr.Ctx.Config.Defaults.DateFormat updatedAtOutput := "" - if timeFormat == "" || timeFormat == "RELATIVE" { + if timeFormat == "" || timeFormat == "relative" { updatedAtOutput = utils.TimeElapsed(pr.Data.UpdatedAt) } else { updatedAtOutput = pr.Data.UpdatedAt.Format(timeFormat)