Skip to content

Commit ade458c

Browse files
authored
Merge pull request #41 from Tanq16/csvfix
Import/Export Fixes
2 parents fbaf7bf + 35484cd commit ade458c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

internal/api/import-export.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,17 @@ func (h *Handler) ImportCSV(w http.ResponseWriter, r *http.Request) {
176176
"2006-01-02 15:04:05", // SQL format
177177
"2006-01-02", // ISO date
178178
"01/02/2006", // US date
179+
"01/02/06", // US date (short year)
180+
"1/2/2006", // US date (no leading zero)
181+
"1/2/06", // US date (short year no leading zero)
179182
"02/01/2006", // European date
180183
"Jan 2, 2006", // Month name format
181184
"2 Jan 2006", // European month name
182185
"January 2, 2006", // Full month name
183186
"2006-01-02T15:04:05", // ISO without timezone
184187
}
185188
for _, format := range dateFormats {
186-
if d, err := time.Parse(format, dateStr); err == nil {
189+
if d, err := time.ParseInLocation(format, dateStr, time.Local); err == nil {
187190
date = d.UTC()
188191
parsedDate = true
189192
break

0 commit comments

Comments
 (0)