Jquery UI Datepicker input validation

I am using Jquery UI datepicker in my AngularJs Application.

HTML:

<div id="wrapper" ng-app="myApp">
  <p>{{datePicker || "0000-00-00"}}</p>
  <input type="text" ng-model="datePicker" datepicker />
</div>

JS:

var myApp = angular.module('myApp', []);

myApp.directive("datepicker", function () {
  return {
    restrict: "A",
    require: "ngModel",
    link: function (scope, elem, attrs, ngModelCtrl) {
      console.log(scope,elem)
      var updateModel = function (dateText) {
        scope.$apply(function () {
          ngModelCtrl.$setViewValue(dateText);
        });
      };
      var options = {
        dateFormat: "yy-mm-dd",
        onSelect: function (dateText) {
          updateModel(dateText);
        }
      };
      elem.datepicker(options);
    }
  }
});

Here I am having the date format as follows yyyy-mm-dd and as the input box is editable, the user can also enter the date in the following formats,

-> YYYYMMDD (20190330)

-> YY-M-D (19-3-30)

-> YYYY-M-D (2019-3-30)

So the question is how to support these three formats while the user enters the date manually…

AngularJs way Working Demo: https://codepen.io/anon/pen/KYzjWa

Only Jquery way working demo: http://jsfiddle.net/vebg8y74/
(It would be at least helpful if you give solution in this jquery format alone)

None of the other solutions around the community helped me.

Even this question doesn’t answer my question. (Don’t suggest any other library or things to use just help me to modify the existing code alone).

So whatever the user enters in the input box, it needs to convert the format to yyyy-mm-dd.

Example if user types in input YYYYMMDD (20190330) , then after entering the date picker input box needs to have the date value as 2019-03-30.

Please don’t give suggestion of making input as readonly and that is not what i want..

Edit:
Consider that user entering the year, month, day respectively inside the input box in any of the three format.. I hope i can handle the validation for entering of other formats such as dd-mm-yyyy or mm-dd-yyyy separately (Not to consider in this question).. For now please take that user is entering the date in any of the three given formats and need to convert it into yyyy-mm-dd..

Source: AngularJS