kontent-ai / delivery-sdk-net

Kontent.ai Delivery .NET SDK

Home Page:https://www.nuget.org/packages/Kontent.Ai.Delivery

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extend datetime element/value converters

dzmitryk-kontent-ai opened this issue · comments

Motivation

Implementing structured model for DateTime element.
The models we currently generate for the SDK support only a flat DateTime? value of DateTimeElement. Nevertheless, now Deliver stores DateTime element in format:

{ "type": "date_time", "name": "Post date", "value": "2014-11-18T00:00:00Z", "display_timezone": "Europe/Prague" }

We want to provide a possibility to our customers to get DateTime element with display_timezone property

Proposed solution

Implement special data model for DateTime element which will contain element's value and Timezone in string format similar to RichText
Add DateTimeContentConverter similar to RichTextContentConverter
We will convert DateTimeElement value to simple DateTime? or to new special model, depending on what data type is in model.
A customer will have a possibility to choose in ModelGenerator, what DateTimeElement data type they want to use - simple DateTime or special data type with DateTime? value and Timezone (string)

Additional context

Add any other context, screenshots, or reference links about the feature request here.

OK let's find where to put the information in the docs and append it + release a version.

Extend the docs here: https://github.com/kontent-ai/delivery-sdk-net/edit/master/docs/customization-and-extensibility/customization-techniques.md ->add section showcasing how you can add you property in partial class to get TimeZone.

Docs updated