Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date/time types fail to unmarshal #38

Closed
sanbornm opened this issue Sep 11, 2015 · 10 comments
Closed

Date/time types fail to unmarshal #38

sanbornm opened this issue Sep 11, 2015 · 10 comments

Comments

@sanbornm
Copy link
Collaborator

As far as I know the Go XML unmarshler doesn't support changing date/time format and often fails if the date/time is not in the go expected format. We should probably map these to string instead of time.Time and let the user parse these later.

@c4milo
Copy link
Member

c4milo commented Sep 11, 2015

That's bummer, but you are right. I've seen it happening sometimes.

@ruzz311
Copy link

ruzz311 commented Sep 21, 2015

I've encountered the same but I really only used gowsdl as a starting point since I had 3 wsdl files with lots of overlap in types / constants.

I got around it by using a struct with an anonymous time.Time ala: http://stackoverflow.com/questions/17301149/golang-xml-unmarshal-and-time-time-fields?answertab=votes#tab-top

@c4milo
Copy link
Member

c4milo commented Sep 21, 2015

Good to know! thanks @ruzz311

@anjmao
Copy link
Collaborator

anjmao commented Oct 8, 2018

Here is sample for custom time https://github.com/NYTimes/encoding-wrapper/blob/master/elementalconductor/time.go which we can use for generated code. Instead of using time.Time we could use DateTime. Could it be added after #107 is merged?

@anjmao anjmao mentioned this issue Oct 9, 2018
2 tasks
@iszak
Copy link
Contributor

iszak commented Feb 14, 2019

I would like to see this feature as I'm hitting this problem. My only concern is, we should only apply this custom type/unmarshalling for W3C XSD dateTime types. There is then a concern of how to handle non-XSD date/time formats, e.g. arbitrary formats from a user perspective.

@tooolbox
Copy link

tooolbox commented Oct 8, 2019

Same as @iszak, just ran into this and I have a SOAP API with a random date format. Need a way to control the formatting.

@moihn
Copy link

moihn commented Feb 24, 2021

Is there any development progress for better xsd:date, xsd:datetime and xsd:time support? I see this ticket hasn't been updated for a while. If not, I am willing to create a PR for them from what we are using.

@c4milo
Copy link
Member

c4milo commented Feb 24, 2021

not much progress on this, unfortunately. Feel free to take a stab at it @moihn.

@moihn
Copy link

moihn commented Feb 26, 2021

I have created a PR for this #195

@c4milo
Copy link
Member

c4milo commented Feb 28, 2021

Closed by #195. Thanks again @moihn!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants