You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rather than using time.Time for sql date fields, shouldn't we rather use civil.Date from https://pkg.go.dev/cloud.google.com/go/civil. This latter type seems to be the standard way to handle dates in go.
Motivation
If one uses time.Time to represent dates, the time part is set to all 0's. If the end user isn't aware that the time part should be ignored, this can cause confusion, and even create errors if it's interpreted in a GMT+ve timezone.
Related Issues
Other
I tried defining a custom struct that uses civil.Date fields, and scanning the database result into this struct. This resulted in a date with value 0000-00-00.
The text was updated successfully, but these errors were encountered:
Describe the feature
Rather than using
time.Time
for sql date fields, shouldn't we rather usecivil.Date
from https://pkg.go.dev/cloud.google.com/go/civil. This latter type seems to be the standard way to handle dates in go.Motivation
If one uses time.Time to represent dates, the time part is set to all 0's. If the end user isn't aware that the time part should be ignored, this can cause confusion, and even create errors if it's interpreted in a GMT+ve timezone.
Related Issues
Other
I tried defining a custom struct that uses civil.Date fields, and scanning the database result into this struct. This resulted in a date with value
0000-00-00
.The text was updated successfully, but these errors were encountered: