Spring Boot GraphQL Tutorial #17 - Date Type

preview_player
Показать описание
Here we implement the DateTime and Date custom scalar types implemented by graphql java extended scalars.

The graphql specification does not define a Date Type or DateTime type due to too many opinions and requirements. This is why we need to define our own custom scalar. Lucky for us there are already two great libraries providing date related scalars: graphql-java-extended-scalars and graphql-java-datetime.

graphql-java-datetime provides a greater range of date scalars such as:

scalar Date

scalar LocalDate

scalar LocalDateTime

scalar LocalTime

scalar OffsetDateTime

scalar YearMonth

scalar Duration

DateTime Scalars provided by extended scalars (graphql-java-extended-scalars):

DateTime:

Time:

Date:

See you in the next tutorial where I give an example of graphql java bean validation.

Thanks!
Philip

Рекомендации по теме
Комментарии
Автор

Why doesn't this library define custom scalar type beans by itself? Is it Spring agnostic?

chillappreciator
Автор

Is there a way to change the datetime format for datetime scalar? I need something like: yyyy-mm-ddTHH:mm

abajoaladerecha
Автор

i want to add timestamp as input, is their any way for that ?

manpreet