mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 04:32:37 +00:00
Use UTC when marshalling times and Local when unmarshalling
Marshal to UTC and read into Local, which means clients automatically show local time and stored values are always consistent.
This commit is contained in:
@@ -78,7 +78,7 @@ func (t *Time) UnmarshalJSON(b []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
t.Time = pt
|
||||
t.Time = pt.Local()
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ func (t Time) MarshalJSON() ([]byte, error) {
|
||||
return []byte("null"), nil
|
||||
}
|
||||
|
||||
return json.Marshal(t.Format(time.RFC3339))
|
||||
return json.Marshal(t.UTC().Format(time.RFC3339))
|
||||
}
|
||||
|
||||
// Fuzz satisfies fuzz.Interface.
|
||||
|
Reference in New Issue
Block a user