Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spec] DateTime converters #75

Closed
haavamoa opened this issue Dec 16, 2019 · 0 comments · Fixed by #77
Closed

[Spec] DateTime converters #75

haavamoa opened this issue Dec 16, 2019 · 0 comments · Fixed by #77
Labels
enhancement New feature or request

Comments

@haavamoa
Copy link
Member

haavamoa commented Dec 16, 2019

Summary

When dealing with DateTime in apps we need to display both date and time in a human readable way. The current ToString() of DateTime is not very readable.

Our API should have different converters that can be used for date and time.

API Changes

Our API should include three more converters:

  • DateConverter
    • A converter that takes a DateTime and convert it into a human readable date stamp.
  • TimeConverter
    • Takes a DateTime and converter it into a human readable time stamp.
  • DateTimeConverter
    • Takes a DateTime and convert it into a human readable date time stamp.

Each converter should:

  • Implement IMarkupExtension.
    • This is to make it easy to use and the possibility of setting properties when using the converter.
  • Have a Format property that will change the format of the output. (I.e; Default, Short, Long ...)
  • Support Norwegian format, which should be controlled through current culture settings on each phone.

Remark

Our converters should be based on the current date time converters that are being used in DIPS desktop client: DIPS Arena

The different formats that the converters should support will be the same ones as we support in DIPS Arena.

Intended Use Case

The format is just an example, this has to be investigated with the current solution in DIPS Arena.

A consumer wants to display an CreatedDate that he has collected from the database. The date should be displayed in a human readable way.

CreatedDate is 01 january 1990 11:00 AM

Without converters

<Label Text={Binding CreatedDate}>

Result

01/01/1990 11:00:00

With DateConverter

<Label Text={Binding CreatedDate, Converter={dxui:DateConverter Format=Short}}>

Result

01. jan 1990

With TimeConverter

<Label Text={Binding CreatedDate, Converter={dxui:TimeConverter Format=Short}}>

Result

11:00 AM

With DateTimeConverter

<Label Text={Binding CreatedDate, Converter={dxui:DateTimeConverter Format=Short}}>

Result

01. jan 1990 11:00 AM
@haavamoa haavamoa added enhancement New feature or request in-progress When work is started labels Dec 16, 2019
@haavamoa haavamoa removed the in-progress When work is started label Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant