go-gorm / go-gorm/datatypes

datatypes.Date Incorrectly Sets Time When Date::Value Is Called

Open
#39 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
831
Forks
124
PR merge metrics
No merged PRs in 30d

Description

When [Date::Value](https://github.com/go-gorm/datatypes/blob/master/date.go#L18) is called it incorrectly sets the time. Note that it sets 0 for values such as hour, minute, etc... This leads to incorrect values being stored in the database.

For example here is the result of running `time.Now().Add(

But the same value returned from the database using `datatypes.Date` is:

```
2021-03-04 08:00:00 +0000
```

This basically makes the `Date` type completely useless

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.