kontent-ai / delivery-sdk-net

Kontent.ai Delivery .NET SDK
https://www.nuget.org/packages/Kontent.Ai.Delivery
MIT License
32 stars 41 forks source link

Extend datetime element/value converters #356

Closed dzmitryk-kontent-ai closed 1 year ago

dzmitryk-kontent-ai commented 1 year ago

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.

Simply007 commented 1 year ago

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

Simply007 commented 1 year ago

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.

Simply007 commented 1 year ago

Docs updated