eduardoborges / use-mask-input

✏️ A react Hook for build elegant input masks. Compatible with React Hook Form
https://npmjs.com/package/use-mask-input
332 stars 19 forks source link

docs: datetime year autofill disable #55

Open ar-to opened 1 year ago

ar-to commented 1 year ago

Felt like a bug until I tracked it down to an option to disable. Consider adding this to the docs in the description so others know what options are available.

Version of this lib used at the time: "use-mask-input": "^3.3.6",

Options from this lib https://github.com/eduardoborges/use-mask-input/blob/3d2cc2dce950f6e5ed7eed7bae08eb10e76d23b8/src/inputmask.types.ts#L547

Options from inputmask:

For this particular autofill fix I found it via https://github.com/RobinHerbots/Inputmask/issues/2266#issuecomment-916838878, and via the prefillYea option at https://robinherbots.github.io/Inputmask/#/documentation/datetime#prefillyear.

Snippet:

      options: {
        inputFormat: 'mm/dd/yyyy',
        prefillYear: false,
      },

prevents the autofill for the year which may feel like unexpected behavior in some cases, e.g. data of birth which should not autofill to current year.