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

feat(ui5-datepicker): set value attribute through date object #1624

Merged
merged 4 commits into from
May 19, 2020
Merged

feat(ui5-datepicker): set value attribute through date object #1624

merged 4 commits into from
May 19, 2020

Conversation

unazko
Copy link
Contributor

@unazko unazko commented May 15, 2020

On initialization of ui5-datepicker its 'value' attribute
string value should be formatted according to the used locale
and provided 'format-pattern' attribute.

Fixes #1503

Thank you for your contribution! 👏

To get it merged faster, kindly review the checklist below:

Pull Request Checklist

…ible

On initialization of ui5-datepicker its 'value' attribute
string value should be formatted according to the used locale
and provided 'format-pattern' attribute.

Fixes #1503
@CLAassistant
Copy link

CLAassistant commented May 15, 2020

CLA assistant check
All committers have signed the CLA.

@unazko unazko changed the title feat(ui5-datepicker): set value attribute through date object now poss… feat(ui5-datepicker): set value attribute through date object May 15, 2020
Copy link
Contributor

@vladitasev vladitasev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!!
Works exactly as I would expect it.

Let's change the API a bit. Remove the setUTC* function and add a new function called formatValue for datepicker and timepicker. This function will just take a value and return a formatted value. Then the user will set this value through the official API. This will enable users to use their framework of choice's binding syntax. As we've done it currently, they can't call setUTCValue from their templates. But they can call formatValue to process whatever comes from their database, assign it to their state, and bind it to their templates.

TODO:

  • Create formatValue function
  • Document it with @public so that it starts appearing in the help
  • Document how it works: you pass it a JS date object, and it returns a string, formatted according to the properties of the date/time/datetime picker instance
  • Let this function be pure. Don't change any state of the component in it. When the user sets the real value property with the result of the new function, only then the valueState will be changed naturally.
  • Update the samples

On initialization of ui5-datepicker its 'value' attribute
string value should be formatted according to the used locale
and provided 'format-pattern' attribute.

Fixes #1503
@unazko unazko requested a review from vladitasev May 18, 2020 15:42
@vladitasev vladitasev merged commit 4d7586d into SAP:master May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DatePicker/TimePicker/DateTimePicker - consider changing how "value" works
3 participants