A birthday is the anniversary of the birth of a person which is celebrated in numerous cultures, often with birthday gifts, birthday cards, a birthday party, or a rite of passage.
There is a distinction between birthday and birth date: The former, other than February 29, occurs each year (e.g. January 20), while the latter is the exact date a person was born (e.g., January 20, 2001).
Why need to mask DOB?
Scammers, fraudsters, and identity thieves can wreak havoc with just your name, date of birth (DOB), and address.Fraudsters need just these three key bits of information to steal your identity and access your accounts, take out loans, credit cards, mobile phones in your name. These can be found on social media profiles, such as Facebook. And if your settings are not private or masked, this is available for anyone to see.
That’s what generally organizations while asking for date of birth masked years part or complete date so that not share by anyone except person working on web page.
There are different pattern to write date but here we mainly focus on most common used pattern (MM/dd/yyyy). According to your need you can modify example with respect to date pattern.
- yyyy.MM.dd : 2001.07.01
- EEE, MMM d : Wed, Jul 4
- EEE, d MMM yyyy : Wed, 4 Jul 2001
- yyyy-MM-dd : 2001-07-01
- MM/dd/yyyy : 07/01/2001
- dd/MM/yyyy : 01/07/2001
See Also :
- Log4j2: How to Mask Logs Personal/Confidential/SPI Information
- How to Mask JSON Confidential/Personal Information in logs :JAVA
- How to mask JAVA Object confidential/personal information in logs while Printing
- How to MASK XML Confidential/Personal Data : JAVA
- How to mask Personal/Confidential Information on web page
DOB (Date of Birth) Masking Example
Here considering, date represent as MM/dd/yyyy. By masking will hide all digits except slaces. For example, Date is 06231987 than after formatting and mask will display as XX/XX/1987.
Create a text box on your page with below html.
<input type="text" id="txtDOB">
Java Script/JQuery Changes
Copy below java script in your head section of page.
This masking example is created considering standard length of text size and formatting of text field, that can vary according to organizations. If your organization having different format and text size modify source code according to your need. If you are facing any issue drop a comments will try to connect as soon as possible.
Download Source code
To download the source code of this example, click on below given download link.
Drop me your questions in comments section.