Skip to content

Commit

Permalink
fix json response time format
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Jacquot committed Aug 5, 2018
1 parent e3cbcb8 commit e490848
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions implem/json.formatter/article.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package formatter

import (
"time"

"github.com/err0r500/go-realworld-clean/domain"
)

const dateLayout = "2006-01-02T15:04:05.999Z"

type Article struct {
Title string `json:"title"`
Slug string `json:"slug"`
Expand Down Expand Up @@ -38,8 +38,8 @@ func NewArticleFromDomain(article domain.Article, user *domain.User) Article {
Title: article.Title,
Description: article.Description,
Body: article.Body,
CreatedAt: article.CreatedAt.UTC().Format(time.RFC3339),
UpdatedAt: article.UpdatedAt.UTC().Format(time.RFC3339),
CreatedAt: article.CreatedAt.UTC().Format(dateLayout),
UpdatedAt: article.UpdatedAt.UTC().Format(dateLayout),
Author: NewProfileFromDomain(article.Author, isFollowingAuthor),
Tags: article.TagList,
Favorite: favorite,
Expand Down
6 changes: 2 additions & 4 deletions implem/json.formatter/comment.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package formatter

import (
"time"

"github.com/err0r500/go-realworld-clean/domain"
)

Expand All @@ -26,8 +24,8 @@ func NewCommentsFromDomain(comments ...domain.Comment) []Comment {
func NewCommentFromDomain(comment domain.Comment) Comment {
return Comment{
ID: comment.ID,
CreatedAt: comment.CreatedAt.UTC().Format(time.RFC3339),
UpdatedAt: comment.UpdatedAt.UTC().Format(time.RFC3339),
CreatedAt: comment.CreatedAt.UTC().Format(dateLayout),
UpdatedAt: comment.UpdatedAt.UTC().Format(dateLayout),
Body: comment.Body,
Author: NewProfileFromDomain(comment.Author, false), //fixme check this
}
Expand Down

0 comments on commit e490848

Please sign in to comment.