lyne-components icon indicating copy to clipboard operation
lyne-components copied to clipboard

fix(sbb-time-input, sbb-datepicker): create get/set for valueAsDate

Open DavideMininni-Fincons opened this issue 1 year ago • 4 comments
trafficstars

Preflight Checklist

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 getValueAsDate and setValueAsDate have 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

DavideMininni-Fincons avatar Nov 29 '23 15:11 DavideMininni-Fincons

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?

DavideMininni-Fincons avatar Dec 01 '23 09:12 DavideMininni-Fincons

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.

kyubisation avatar Dec 01 '23 10:12 kyubisation

For two strategy reasons we would like to wait merging this PR

  1. 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
  2. We are planning to support native form support which potentially (probably not) could conflict with some of the changes.

jeripeierSBB avatar Dec 12 '23 13:12 jeripeierSBB