Initial commit
This commit is contained in:
commit
b6014c6ffc
47 files changed
+4329
No files matched your search
@@ -0,0 +1,18 @@
|
||||
package handlers
|
||||
|
||||
import "time"
|
||||
|
||||
const dateLayout = "2006-01-02"
|
||||
|
||||
// parseOptionalDate parses a "YYYY-MM-DD" string, treating nil/empty as no
|
||||
// value. Used for the optional date fields on car/reminder inputs.
|
||||
func parseOptionalDate(s *string) (*time.Time, error) {
|
||||
if s == nil || *s == "" {
|
||||
return nil, nil
|
||||
}
|
||||
t, err := time.Parse(dateLayout, *s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &t, nil
|
||||
}
|
||||
Reference in new issue
Block a user