Skip to content
Michael Dostál edited this page Nov 14, 2018 · 1 revision

The library will automatically transform date values into Date objects and it will serialize them when sending to the server. In order to do that, remember to set the type of the corresponding attribute as Date:

@JsonApiModelConfig({
    type: 'posts'
})
export class Post extends JsonApiModel {

    // ...

    @Attribute()
    created_at: Date;

}

Moreover, it should be noted that the following assumptions have been made:

  • Dates are expected to be received in one of the ISO 8601 formats, as per the JSON API spec recommendation;
  • Dates are always sent in full ISO 8601 format, with local timezone and without milliseconds (example: 2001-02-03T14:05:06+07:00).
Clone this wiki locally