Skip to content

Commit

Permalink
chore: experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbarsukov committed Oct 29, 2024
1 parent 95305d0 commit d09d137
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions projects/demo/src/pages/kit/time/examples/2-am-pm/mask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,16 @@ export default {
maskitoUpdateElement(element, `${element.value} AM`);
}
}),
(element) => {
const listener = (): void => {
element.inputMode =
element.selectionStart! >= 'HH:MM'.length ? 'text' : 'decimal';
};

element.ownerDocument.addEventListener('selectionchange', listener);

return () =>
element.ownerDocument.removeEventListener('selectionchange', listener);
},
],
} satisfies MaskitoOptions;

0 comments on commit d09d137

Please sign in to comment.