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

DateTime type behaviour problem #250

Closed
ty2 opened this issue Oct 6, 2017 · 2 comments
Closed

DateTime type behaviour problem #250

ty2 opened this issue Oct 6, 2017 · 2 comments
Labels

Comments

@ty2
Copy link

ty2 commented Oct 6, 2017

a query with DateTime argument variable, it will be time.Time in go

query SiteDetail($from: DateTime!) {
  data(from: $from){
          from
  }
}

a query with DateTime argument in string, it will be string in go

query {
  data(from: "2017-10-06T03:40:00.000Z"){
          from
  }
}
from := params.Args["from"]
switch from.(type) {
	case string:
		fmt.Println("String")
	case time.Time:
		fmt.Println("Time")
}

if a query with DateTime argument variables in string, it should be converted to time.Time

@MrSaints
Copy link

I've just come across this exact issue. To clarify, the value from params.Args is a time.Time when the argument is given through a variable. It is a string when given directly. Consequently, the resolver needs to handle both cases. I'm unsure if this is intended or a bug, but it is definitely not expected behaviour as a developer interfacing with this package.

@ccbrown
Copy link
Contributor

ccbrown commented Nov 16, 2018

I'm pretty confident this was unintentional and just a bug. I've put in a PR to fix it (see above).

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

No branches or pull requests

4 participants