lyne-components
lyne-components copied to clipboard
fix(sbb-time-input, sbb-datepicker): create get/set for valueAsDate
Preflight Checklist
- [x] I have read the Contributing Guidelines for this project.
- [x] I agree to follow the Code of Conduct that this project adheres to.
- [x] I have searched the pull request tracker for a Pull Request (PR) that matches the one I want to submit, without success.
Issue
This PR Closes #2223
Pull request checklist
Please check if your PR fulfills the following requirements:
- [ ] Tests for the changes have been added (for bug fixes / features)
- [x] Docs have been reviewed and added / updated if needed (for bug fixes / features)
See Review Guidelines for more information what is checked during review process.
Changes
Changes in this pull request:
- the two methods
getValueAsDateandsetValueAsDatehave been removed and replaced with a getter/setter
Browsers
I tested the build on the following browsers:
- [ ] Firefox Desktop
- [ ] Chrome Desktop
- [ ] Edge Desktop
- [ ] Safari Desktop
- [ ] Chrome Mobile
- [ ] Safari Mobile
Screen readers
I tested the build on the following browsers:
- [ ] JAWS Firefox Desktop
- [ ] JAWS Chrome Desktop
- [ ] NVDA Firefox Desktop
- [ ] NVDA Chrome Desktop
- [ ] VoiceOver Safari Desktop
- [ ] VoiceOver Chrome Desktop
- [ ] VoiceOver Safari Mobile
- [ ] Android Accessibility Suite Chrome Mobile
Pull request type
Please check the type of change your PR introduces:
- [ ] Bugfix
- [x] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):
Does this introduce a breaking change?
- [x] Yes
- [ ] No
BREAKING CHANGES Consumers which uses the two methods should change them to:
// OLD CODE
const date = <component>.getValueAsDate();
<component>.setValueAsDate(new Date());
// NEW CODE
const date = <component>.valueAsDate;
<component>.valueAsDate = new Date();
Other information
Hello @kyubisation
about this, I noticed that the valueAsDate property is added into the readme file (the related attribute is wrong and the fixi of generation script should be handled in the story #2246 ).
Is this ok for you? Should I add the @property annotation on the setter?
I think for the short term this is ok. It is not an attribute, but just a property. Once we attempt the refactoring for the native form support, we can further investigate how to properly handle this.
Codecov Report
Attention: Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| ...epicker/datepicker-next-day/datepicker-next-day.ts | 93.67% <75.00%> (ø) |
|
| ...datepicker-previous-day/datepicker-previous-day.ts | 93.72% <75.00%> (ø) |
|
| .../datepicker/datepicker-toggle/datepicker-toggle.ts | 90.70% <75.00%> (ø) |
|
| src/components/datepicker/datepicker/datepicker.ts | 96.91% <93.75%> (ø) |
|
| src/components/time-input/time-input.ts | 97.93% <90.90%> (ø) |
For two strategy reasons we would like to wait merging this PR
- We would like to wait with breaking changes for a couple of weeks until the consumers migrated to lit and will in this period not be overwhelmed with changes
- We are planning to support native form support which potentially (probably not) could conflict with some of the changes.