Skip to content
This repository was archived by the owner on Dec 11, 2017. It is now read-only.

Add custom date placeholders#218

Closed
simonschaufi wants to merge 1 commit intodigitalBush:masterfrom
simonschaufi:germanwings_mod
Closed

Add custom date placeholders#218
simonschaufi wants to merge 1 commit intodigitalBush:masterfrom
simonschaufi:germanwings_mod

Conversation

@simonschaufi
Copy link

This is a patch by germanwings i found while booking a flight ;)
It adds new placeholders for (birth)dates that can be overwritten to localize them by setting:

$.mask.placeholders['D'] = 'T';

So instead of having underlines, you can now have DD.MM.YYYY as placeholder. Very nice!

This can also be extended more to use Hour and Second for example.

@simonschaufi
Copy link
Author

oh, while browsing through other pull requests, i found #182 which is almost the same.

@digitalBush
Copy link
Owner

Thank you for the suggestion! This is why I exposed the hook to allow custom placeholders. Until we have a date specific mask option, I'd like to hold off on adding these as defaults.

@simonschaufi
Copy link
Author

@digitalBush can you please explain how to use "the hook"?

@FagnerMartinsBrack
Copy link
Contributor

@simonschaufi

Probably like this:

$.extend( $.mask, {
    definitions: {
        // configs here
    },
    placeholders: {
        // Configs here
    }
});

@digitalBush
Copy link
Owner

@simonschaufi I misspoke just a bit. I meant custom mask definitions. I'd like to hold off on the placeholder thing I think until I have a way to do proper date masking.

The eyescript sample from the README is good example of adding definitions.

 $.mask.definitions['~']='[+-]';
 $("#eyescript").mask("~9.99 ~9.99 999");

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants