Prepare reports for Promptkit migration
This commit is contained in:
@@ -90,14 +90,3 @@ func ParseLocalDate(value string, location *time.Location) (time.Time, error) {
|
||||
}
|
||||
return parsed, nil
|
||||
}
|
||||
|
||||
func ParseStormTime(value string, location *time.Location) (time.Time, error) {
|
||||
if parsed, err := time.Parse(time.RFC3339, value); err == nil {
|
||||
return parsed, nil
|
||||
}
|
||||
parsed, err := time.ParseInLocation(LocalDateTimeLayout, value, location)
|
||||
if err != nil {
|
||||
return time.Time{}, fmt.Errorf("parse storm time %q as YYYY-MM-DDTHH:MM or RFC3339: %w", value, err)
|
||||
}
|
||||
return parsed, nil
|
||||
}
|
||||
|
||||
@@ -39,22 +39,3 @@ func TestParseLocalDate(t *testing.T) {
|
||||
t.Fatalf("location = %v, want test location", got.Location())
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseStormTime(t *testing.T) {
|
||||
location := time.FixedZone("Test", -5*60*60)
|
||||
local, err := ParseStormTime("2026-05-29T18:00", location)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseStormTime(local) error = %v", err)
|
||||
}
|
||||
if local.Location() != location {
|
||||
t.Fatalf("local location = %v, want test location", local.Location())
|
||||
}
|
||||
|
||||
rfc3339, err := ParseStormTime("2026-05-29T18:00:00-05:00", location)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseStormTime(rfc3339) error = %v", err)
|
||||
}
|
||||
if rfc3339.Format(time.RFC3339) != "2026-05-29T18:00:00-05:00" {
|
||||
t.Fatalf("rfc3339 = %s, want preserved offset time", rfc3339.Format(time.RFC3339))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user