cloudfoundry / cloudfoundry/go-cfclient
TimestampFilter uses wrong format when timezone != GMT
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 70
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
I am using the following code(snippet) :
dateFilter := client.TimestampFilterList{}
dateFilter.Before(graceDate)
serviceInstanceListOptions := client.ServiceInstanceListOptions{
ListOptions: &client.ListOptions{UpdatedAts: dateFilter},
}
serviceInstances, err := cfClient.ServiceInstances.ListAll(ctx, &serviceInstanceListOptions)
This works fine as long as your local timezone is GMT, then RCF3339 formats to something like 'YYYY-MM-DDThh:mm:ssZ', which is the format the CF V3 API expects.
In my case the timezone is Europe/Amsterdam, and then RFC3339 formats to 'YYYY-MM-DDThh:mm:ss+02:00'
The ListAll call returns the error:
error executing GET request for /v3/service_instances?updated_ats%5Blt%5D=2025-05-10T11%3A54%3A11%2B02%3A00: cfclient error (CF-BadQueryParameter|10005): The query parameter is invalid: Updated ats has an invalid timestamp format. Timestamps should be formatted as 'YYYY-MM-DDThh:mm:ssZ'
My guess is this requires some tweaks in the Serializer?
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in client/filter.go around the Serializer referenced by the issue and reproduce the TimestampFilter behavior with a non-GMT timezone such as Europe/Amsterdam. Confirm that the generated service-instances query uses the CF V3 API's expected YYYY-MM-DDThh:mm:ssZ timestamp format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100