- commit
- 9a160b1
- parent
- 8085b4f
- author
- Eric Bower
- date
- 2024-07-18 13:59:10 -0400 EDT
refactor: store patch author date as datetime
M
cli.go
+1,
-1
1@@ -523,7 +523,7 @@ Here's how it works:
2 w := NewTabWriter(sesh)
3 fmt.Fprintln(w, "Idx\tTitle\tCommit\tAuthor\tDate")
4 for idx, patch := range opatches {
5- timestamp := AuthorDateToTime(patch.AuthorDate, be.Logger).Format(be.Cfg.TimeFormat)
6+ timestamp := patch.AuthorDate.Format(be.Cfg.TimeFormat)
7 fmt.Fprintf(
8 w,
9 "%d\t%s\t%s\t%s <%s>\t%s\n",
M
db.go
+1,
-1
1@@ -58,7 +58,7 @@ type Patch struct {
2 PatchsetID int64 `db:"patchset_id"`
3 AuthorName string `db:"author_name"`
4 AuthorEmail string `db:"author_email"`
5- AuthorDate string `db:"author_date"`
6+ AuthorDate time.Time `db:"author_date"`
7 Title string `db:"title"`
8 Body string `db:"body"`
9 BodyAppendix string `db:"body_appendix"`
M
util.go
+1,
-1
1@@ -149,7 +149,7 @@ func parsePatchset(patchset io.Reader) ([]*Patch, error) {
2 patches = append(patches, &Patch{
3 AuthorName: authorName,
4 AuthorEmail: authorEmail,
5- AuthorDate: header.AuthorDate.UTC().String(),
6+ AuthorDate: header.AuthorDate.UTC(),
7 Title: header.Title,
8 Body: header.Body,
9 BodyAppendix: header.BodyAppendix,
M
web.go
+1,
-1
1@@ -404,7 +404,7 @@ func prDetailHandler(w http.ResponseWriter, r *http.Request) {
2 }
3
4 for _, patch := range patches {
5- timestamp := AuthorDateToTime(patch.AuthorDate, web.Logger).Format(web.Backend.Cfg.TimeFormat)
6+ timestamp := patch.AuthorDate.Format(web.Backend.Cfg.TimeFormat)
7 diffStr, err := parseText(web.Formatter, web.Theme, patch.RawText)
8 if err != nil {
9 web.Logger.Error("cannot parse patch", "err", err)