15
// uses 0, 3, 6 or 9 fractional digits.
16
// Copied from https://github.com/protocolbuffers/protobuf-go/blob/0b2c87d84c27802dae7248480444e22421ba577d/encoding/protojson/well_known_types.go#L749C1-L826C2
18
>
x := t.UTC().Format("2006-01-02T15:04:05.000000000")
19
>
x = strings.TrimSuffix(x, "000")
20
>
x = strings.TrimSuffix(x, "000")
21
>
x = strings.TrimSuffix(x, ".000")
22
>
return x + "Z"
23
>
}
24
25
// unmarshalTimestamp unmarshals a string into a Time instance. Uses RFC 3339, with some extra validation to ensure that