I have some requirement that is below.
1 User should input day, month and year from left to right.
2 If user type 1 in the day or month then 0 automatically add before 1 like 01,02,03 etc. I want user type both 01,02,05 ,10,15 instead of automatically add 0.
we suggest you use the format property when you need to change the entered value to single or two-digit values.
find the code example here:
<p>Format: M/d/yyyy for single digit values</p>
<p>Format: MM/dd/yyyy for double digit values</p>
public format1: string = 'M/d/yyyy';
public format: string = 'MM/dd/yyyy';
find the sample here: https://stackblitz.com/edit/angular-vqucjy?file=app.component.ts,app.component.html
Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.
Dear Sureshkumar P ,
In your previous example my requirement is not full fulling. When I am typing 1 in [dd] 0 is adding before it. Typing of day, month and year from left to right instead of right to left.
Actually I want typing manually not automatic. In your Datepicker Mask Control 0 is adding before any typing. Again I am repeating typing should be start left to right.
Please give me appropriate solution for it.
I have attached file which I actually want? Please find the attach file.
We will validate the requirement in our component. We update you in two business days (October 19th, 2022).
This is the default behavior of our component. When you use the format as [dd] then our component inserted 0 before the single digit value like 01. If you don’t want to allow the 0 before the single digit number, then we suggest you use the format as [d] instead of [dd].