duetds/date-picker

Support only having some params set in localization

umer936 opened this issue · 2 comments

Say I just want to change the placeholder.

Currently, I have to pass in all of the fields in localization according to #29 (comment) . However, I have found that as long as I pass in dayNames, monthNames, and monthNamesShort, nothing breaks.

Describe the solution you'd like
If I just want to change the placeholder, there's no reason I need to have my own copies of the fields in the localization object. It should default to the default if a value is not given.

That feature would be super helpful! As a workaround, the default localization options can be imported from here:

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

The defaults can be used like this:

myDatePickerElement.localization = {
  ...dateLocalization,
  locale: 'en-US'
};

This module doesn't include type declarations, so you'll need to declare the module in a d.ts file if you're using TypeScript:

declare module '@duetds/date-picker/dist/collection/components/duet-date-picker/date-localization';

See also #101