Allow for empty values, nillable parsing

This commit is contained in:
2024-01-18 03:08:09 -06:00
parent 849fa153c8
commit 0e9bcaf07c
2 changed files with 19 additions and 9 deletions
+3 -3
View File
@@ -184,15 +184,15 @@ type NaiveTime struct {
Minutes uint
}
func (nt NaiveTime) Sub(other NaiveTime) time.Duration {
func (nt *NaiveTime) Sub(other *NaiveTime) time.Duration {
return time.Hour*time.Duration(nt.Hours-other.Hours) + time.Minute*time.Duration(nt.Minutes-other.Minutes)
}
func ParseNaiveTime(integer uint64) NaiveTime {
func ParseNaiveTime(integer uint64) *NaiveTime {
minutes := uint(integer % 100)
hours := uint(integer / 100)
return NaiveTime{Hours: hours, Minutes: minutes}
return &NaiveTime{Hours: hours, Minutes: minutes}
}
func (nt NaiveTime) String() string {