Skip to content

Commit

Permalink
fix: error when rated at time didn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
believer committed Jan 3, 2025
1 parent 6cb57a3 commit 78f7876
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion types/movie.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type Movie struct {
Overview string `db:"overview" json:"overview"`
Poster string `db:"poster"`
Rating sql.NullInt64 `db:"rating"`
RatedAt time.Time `db:"rated_at"`
RatedAt sql.NullTime `db:"rated_at"`
ReleaseDate time.Time `db:"release_date" json:"release_date"`
Runtime int `db:"runtime"`
Seen bool `db:"seen"`
Expand Down
4 changes: 2 additions & 2 deletions views/movie.templ
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ templ Movie(props MovieProps) {
if props.Movie.Rating.Valid {
@c.DescriptionListItem(c.DescriptionListItemProps{Detail: "Rating", IsTabular: false}) {
<time
title={ props.Movie.RatedAt.Format("2006-01-02 15:04") }
datetime={ props.Movie.RatedAt.Format("2006-01-02T15:04:05Z") }
title={ props.Movie.RatedAt.Time.Format("2006-01-02 15:04") }
datetime={ props.Movie.RatedAt.Time.Format("2006-01-02T15:04:05Z") }
>
{ strconv.FormatInt(props.Movie.Rating.Int64, 10) }
</time>
Expand Down
8 changes: 4 additions & 4 deletions views/movie_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 78f7876

Please # to comment.