relaxed-date-time

Relaxed date time parser and converter for Spring Boot 2

License

License

GroupId

GroupId

de.ottonow
ArtifactId

ArtifactId

relaxed-date-time
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

relaxed-date-time
Relaxed date time parser and converter for Spring Boot 2
Project URL

Project URL

https://github.com/ottonow/relaxed-date-time
Source Code Management

Source Code Management

https://github.com/ottonow/relaxed-date-time

Download relaxed-date-time

How to add to project

<!-- https://jarcasting.com/artifacts/de.ottonow/relaxed-date-time/ -->
<dependency>
    <groupId>de.ottonow</groupId>
    <artifactId>relaxed-date-time</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/de.ottonow/relaxed-date-time/
implementation 'de.ottonow:relaxed-date-time:0.1.0'
// https://jarcasting.com/artifacts/de.ottonow/relaxed-date-time/
implementation ("de.ottonow:relaxed-date-time:0.1.0")
'de.ottonow:relaxed-date-time:jar:0.1.0'
<dependency org="de.ottonow" name="relaxed-date-time" rev="0.1.0">
  <artifact name="relaxed-date-time" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.ottonow', module='relaxed-date-time', version='0.1.0')
)
libraryDependencies += "de.ottonow" % "relaxed-date-time" % "0.1.0"
[de.ottonow/relaxed-date-time "0.1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.11
com.fasterxml.jackson.module : jackson-module-kotlin jar 2.9.8

Project Modules

There are no modules declared in this project.

Relaxed Date Time

This library adds relaxed date time parsing for APIs in Spring Boot 2 using Jackson. The library is configured automatically, when included.

Build Status Maven Central License

Installation

Artifacts are published to maven central.

Gradle:

compile de.ottonow:relaxed-date-time:0.1.0

Maven:

<dependency>
    <groupId>de.ottonow</groupId>
    <artifactId>relaxed-date-time</artifactId>
    <version>0.1.0</version>
</dependency>

Supported types

  • Instant
  • OffsetDateTime
  • LocalDate

Supported Formats

DateTime

  • 2018-08-08T17:23:59.000Z
  • 2018-08-08T17:23:59Z
  • 2018-08-08T17:23:59+00:00
  • 2018-08-08T17:23:59+0000
  • 2018-08-08T17:23:59+00
  • 2018-08-08T17:23:59

Date

  • 2018-08-08
  • TBD

Usage

DateTime in Dtos

The parser is auto-configured for the default Spring Boot 2 Jackson ObjectMapper.

data class Dto (
    private val createdAt: Instant
)
@RequestMapping(value = ["/my-service/create"], method = [RequestMethod.PUT])
fun createDto(@RequestBody dto: Dto) {
    println(dto.createdAt)
}

RequestParam

When parsing date time as RequestParam, you need to use @IsoDateTime explicitly.

@RequestMapping(value = ["/my-service/since"], method = [RequestMethod.GET])
fun findEntitiesSince(
    @IsoDateTime since: Instant
) {
    println(since)
}
de.ottonow

OTTO NOW

Versions

Version
0.1.0