Skip to content

Commit 9a160b1

Browse files
committed
refactor: store patch author date as datetime
1 parent 8085b4f commit 9a160b1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ Here's how it works:
523523
w := NewTabWriter(sesh)
524524
fmt.Fprintln(w, "Idx\tTitle\tCommit\tAuthor\tDate")
525525
for idx, patch := range opatches {
526-
timestamp := AuthorDateToTime(patch.AuthorDate, be.Logger).Format(be.Cfg.TimeFormat)
526+
timestamp := patch.AuthorDate.Format(be.Cfg.TimeFormat)
527527
fmt.Fprintf(
528528
w,
529529
"%d\t%s\t%s\t%s <%s>\t%s\n",

db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type Patch struct {
5858
PatchsetID int64 `db:"patchset_id"`
5959
AuthorName string `db:"author_name"`
6060
AuthorEmail string `db:"author_email"`
61-
AuthorDate string `db:"author_date"`
61+
AuthorDate time.Time `db:"author_date"`
6262
Title string `db:"title"`
6363
Body string `db:"body"`
6464
BodyAppendix string `db:"body_appendix"`

util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func parsePatchset(patchset io.Reader) ([]*Patch, error) {
149149
patches = append(patches, &Patch{
150150
AuthorName: authorName,
151151
AuthorEmail: authorEmail,
152-
AuthorDate: header.AuthorDate.UTC().String(),
152+
AuthorDate: header.AuthorDate.UTC(),
153153
Title: header.Title,
154154
Body: header.Body,
155155
BodyAppendix: header.BodyAppendix,

web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ func prDetailHandler(w http.ResponseWriter, r *http.Request) {
404404
}
405405

406406
for _, patch := range patches {
407-
timestamp := AuthorDateToTime(patch.AuthorDate, web.Logger).Format(web.Backend.Cfg.TimeFormat)
407+
timestamp := patch.AuthorDate.Format(web.Backend.Cfg.TimeFormat)
408408
diffStr, err := parseText(web.Formatter, web.Theme, patch.RawText)
409409
if err != nil {
410410
web.Logger.Error("cannot parse patch", "err", err)

0 commit comments

Comments
 (0)