Next question :sweat_smile: This is actually a co...
# apollo-kotlin
c
Next question 😅 This is actually a combination of two outcomes of two previous questions I've asked. I basically have my backend that's (somehow) defining two different types WITH the same scalar type (not sure if thats the right use of scalar)... But anyway. Query 1 has
doneDate
which in apollo explorer says it'll be type
Date
in format
YYYY-MM-DD
and the date does indeed come back as
2022-02-17
Query 2 has
addedDate
which in apollo explorer says it'll be in type
Date
in format
YYYY-MM-DD
and the date comes back as
2023-02-22T20:32:04.000Z
So two different queries... same Date type that's being returned, but two diff formats. 1. This is wrong right? Seems like our backend uses a Date type for two different types. 2. What's the best way to paper over my backend issues at this point? I can write a custom adapter for
Date
that knows how to handle both formats?
b
1. It may not be "technically" wrong as the Date scalar could be defined as "something that can have these 2 formats: either a date only, or a date with time". But I think it's almost obvious that this is not a great idea and 2 different scalars would be preferable. 2. If you can't convince the backend to differentiate with 2 scalars, yes you could deal with it by making your own adapter that tries the first format first and then fallback to the second one if the first try fails. Not super elegant but should work.
c
Re: 1 "the Date scalar could be defined as "something that can have these 2 formats" Good to know. I am a bit confused at why the adapter configuration in gradle seems to work for one and fails for the other, and vice versa.
Re 2: Oh okay. so it sounds like the Date scalar can be defined as having those 2 formats, but I'd still have to handroll my own adapter. Cool cool. Alright. This is helpful. Let me try to find docs on the Date scalar and Date scalar adapter for android and show my backend team that they don't match up.