title: How to make the date input mask in angular?
body: <p>I am trying to make the input date of birth mask in angular and  format of date  is dd/mm/yyyy ,but it not set and return the input according to our requirement input value.  </p>
  
  <p>my code given below.</p>
  
  <pre><code>&lt;input type="text"  placeholder="{{timePlaceholder}}" (focus)="showlable()" (focusout)="hidelable()" (keypress)="this.value =fixDatePattern($event);"&gt;
      currentDate:any = "";
  currentLength:any ="";
  lastNumberEntered:any ="";
  transformedDate:any="";
  dateCountTracker:any="";
  
      fixDatePattern(event) {
      this.currentDate = event.target.value;
      this.currentLength = this.currentDate.length;
      this.lastNumberEntered = this.currentDate[this.currentLength - 1];
  
      if (this.currentLength &gt; 10) {
        return this.currentDate.substring(0, 10);
      }
  
      if (this.currentLength == 1 &amp;&amp; this.currentDate &gt; 1) {
       this.transformedDate = "0" + this.currentDate + '/';
        this.dateCountTracker = 2;
        this.currentLength = this.transformedDate.length;
        return this.transformedDate;
      } else if (this.currentLength == 4 &amp;&amp; this.currentDate[3] &gt; 3) {
        this.transformedDate = this.currentDate.substring(0, 3) + "0" + this.currentDate[3] + '/';
        this.dateCountTracker = 5;
        this.currentLength = this.transformedDate.length;
        return this.transformedDate;
      } else if (this.currentLength == 2 &amp;&amp; (this.dateCountTracker != 2 &amp;&amp; this.dateCountTracker != 3)) {
        this.dateCountTracker = this.currentLength;
        return this.currentDate + '/';
      } else if (this.currentLength == 5 &amp;&amp; (this.dateCountTracker != 5 &amp;&amp; this.dateCountTracker != 6)) {
        this.dateCountTracker = this.currentLength;
        return this.currentDate + '/';
      }
      this.dateCountTracker = this.currentLength;
      return this.currentDate;
    }
  </code></pre>