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-calendar): Declarative dates support added #2648

Merged
merged 12 commits into from
Jan 12, 2021

Conversation

vladitasev
Copy link
Contributor

@vladitasev vladitasev commented Jan 8, 2021

Changes:

  • new component added: ui5-date with a single value property of type String (formatted date)
  • ui5-calendar has a new slot: dates that accepts instances of ui5-date
  • The selectedDates property is removed from ui5-calendar and replaced with a getter and setter which mimic the old behavior entirely. get selectedDates returns an array of UTC timestamps and set selectedDates allows to pass such an array and build the dates as children of the calendar itself. This can be used as a utility and is used internally.
  • The user can suppress the selected-dates-change event in order to prevent the default behavior of the ui5-calendar creating instances of ui5-date inside itself.
  • The ui5-date-picker, ui5-daterange-picker and ui5-datetime-picker components have been slightly reworked to use the new API of ui5-calendar (although they would have worked with the compatibility getter/setter too).

BREAKING CHANGE:

  • The property selectedDates is deprecated for ui5-calendar. Instead of setting selectedDates as an array of UTC timestamps, please provide instances of ui5-date as children of the ui5-calendar. Instead of reading the selectedDates property to find out which dates the user selected, please read the children of the ui5-calendar (instances of ui5-date with value property).
    Important: for backward compatibility there are the get selectedDates and set selectedDates getter and setter methods that mimic the old behavior entirely so your code can continue to work.

closes: #2528

@vladitasev vladitasev merged commit 6602fba into master Jan 12, 2021
@vladitasev vladitasev deleted the declarative-selected-dates branch January 12, 2021 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calendar: Declarative way of setting the selected days
2 participants