google / jsonapi

jsonapi.org style payload serializer and deserializer
http://godoc.org/github.com/google/jsonapi
MIT License
1.42k stars 211 forks source link

Add RFC3339 timestamp #201

Closed omarismail closed 3 years ago

omarismail commented 3 years ago

Background

Go has a time format called RFC3339.

RFC3339     = "2006-01-02T15:04:05Z07:00"

PR Description

This PR introduces the ability to add an annotation jsonapi:"attr,next,rfc3339" to a time.Time attribute, and it will parse the time according to the Go RFC3339 time format.

google-cla[bot] commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

omarismail commented 3 years ago

@googlebot I signed it!

quetzyg commented 3 years ago

@aren55555 this PR was merged without the proper updates in the response code.

Mainly here, here and here.

aren55555 commented 3 years ago

@quetzyg yes I tried this last night and it appeared supplying the annotation resulted in the time still being serialized as a numeric value rather than a string. Reverted it.

aren55555 commented 3 years ago

I've corrected this in #204