Closed jiridanek closed 1 week ago
From https://pkg.go.dev/time#example-Parse
// Some valid layouts are invalid time values, due to format specifiers
// such as _ for space padding and Z for zone information.
// For example the RFC3339 layout 2006-01-02T15:04:05Z07:00
// contains both Z and a time zone offset in order to handle both valid options:
// 2006-01-02T15:04:05Z
// 2006-01-02T15:04:05+07:00
t, _ = time.Parse(time.RFC3339, "2006-01-02T15:04:05Z")
fmt.Println(t)
t, _ = time.Parse(time.RFC3339, "2006-01-02T15:04:05+07:00")
fmt.Println(t)
_, err := time.Parse(time.RFC3339, time.RFC3339)
fmt.Println("error", err) // Returns an error as the layout is not a valid time value
Looks like the right Java format for this should be
yyyy-MM-dd'T'HH:mm:ssXXX
Which is exactly what we have already. Wat!?!
oc get --raw '/api/v1/namespaces/redhat-ods-operator/pods/rhods-operator-76bb96fb9d-qg2cs/log?pretty=false&sinceTime=2024-10-16T14:36:58+02:00'
Error from server (BadRequest): parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00"
easily reproduced
That +
in the URL needs to be encoded to %2b
, for some reason fabric8 does not do that.
Also, we are using new Date()
that could be replaced with Instant.now()
. Instants don't carry a timezone and are always holding UTC time, which does not have no +
in them.
I'm blaming fabric8 kubernetes client