I'm a newbie in angular js, I'm using AngularJs - 1.6.9. I'm using angularjs-bootstrap-datetimepicker directive for date time. This is an easy code for implementation & works fine with default date time format. The issue has come up when I want to change the date time format in Input Field. Here is my working code.
<div class="form-group col-md-2"
ng-class="{'has-error': myForm.edtaDate.$error.required, 'has-success': myForm.edtaDate.$valid }
<label>EDTA</label>
<div class="dropdown date_dropdown">
<a class="dropdown-toggle" id="dropdown1" role="button"
data-toggle="dropdown" data-target="dropdown1" href="#">
<div class="input-group">
<input type="text" required id="edtaDate" name="edtaDate"
class="form-control" data-ng-model="myModel.edtaDate">
<span class="input-group-addon">
<i class="glyphicon glyphicon-calendar"></i>
</span>
</div>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<datetimepicker data-before-render="startDateBeforeRender($dates)"
data-ng-model="myModel.edtaDate"
data-datetimepicker-config="{ dropdownSelector: '#dropdown1' }">
</datetimepicker>
</ul>
</div>
</div>
In the above code everything working fine. Let's focus on the issue when I changed the format here is the code:
<input type="text" required id="edtaDate" name="edtaDate"
class="form-control"
data-ng-model="myModel.edtaDate | date:'yyyy-MM-dd HH:mm'">
just using the piping, date time format change but the new issue has occurred, angular "has-error" or "has-success" not work.
Now I want to change the date time format according to my ease with has-error or has-success. i've gone through few suggestions but not working, here is the link: angularJs date formatting on input field change, Change the date time format in angularjs, Change Date input field format in angular and many more but the problem still remains the same. Thanks in advance.