Skip to content

Commit

Permalink
try and add docs for date format, use lowerwcase relative
Browse files Browse the repository at this point in the history
  • Loading branch information
miniscruff authored and dlvhdr committed Apr 11, 2024
1 parent 8ad08bc commit 94c6603
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions docs/data/schemas/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ui/components/issue/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ui/components/pr/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 94c6603

Please sign in to comment.