Skip to content

Commit

Permalink
fix time field
Browse files Browse the repository at this point in the history
  • Loading branch information
congzhegao committed Nov 5, 2023
1 parent bbeef0b commit 7696549
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion management/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,13 @@ func (l Logv2) GetDate() time.Time {
if _, ok := l["date"]; !ok {
return time.Time{}
}
return l["date"].(time.Time)
dateStr := l["date"].(string)
parsed, err := time.Parse(time.RFC3339, dateStr)
if err != nil {
fmt.Println("Failed to parse dateStr " + dateStr)
return time.Time{}
}
return parsed
}

func (l Logv2) String() string {
Expand Down

0 comments on commit 7696549

Please sign in to comment.