date-picker icon indicating copy to clipboard operation
date-picker copied to clipboard

Expose default localization hash

Open romaricpascal opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. I needed to provided the date picker with a custom localisation hash that only had a few keys different from the default one. Having to provide all the localisation keys required me to hunt for these default values in the repository.

Describe the solution you'd like It'd be great if the Hash with the default keys was made accessible somehow (both when using a bundler or not). I did manage to sort myself with the following import, but that'd only work when getting the package from NPM and using a bundler:

import DUET_DEFAULT_LOCALIZATION from '@duetds/date-picker/dist/collection/components/duet-date-picker/date-localization';

Describe alternatives you've considered I did try to access the localization property on the element after creation:

const picker = document.createElement('duet-date-picker');
picker.localization // undefined :(

// Some code that adds the picker to the page

requestAnimationFrame(() => { // For lack of a better way to check that the picker is hydrated
  console.log(picker.localization); // same
});

romaricpascal avatar Jan 27 '22 14:01 romaricpascal