-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Description
Summary
We should make string counterparts to FormatTimeBytes and ParseTimeBytes
Lines 64 to 77 in eee23d9
| // Formats a time.Time into a []byte that can be sorted | |
| func FormatTimeBytes(t time.Time) []byte { | |
| return []byte(t.UTC().Round(0).Format(SortableTimeFormat)) | |
| } | |
| // Parses a []byte encoded using FormatTimeKey back into a time.Time | |
| func ParseTimeBytes(bz []byte) (time.Time, error) { | |
| str := string(bz) | |
| t, err := time.Parse(SortableTimeFormat, str) | |
| if err != nil { | |
| return t, err | |
| } | |
| return t.UTC().Round(0), nil | |
| } |
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned
Reactions are currently unavailable