Reputation: 13
Is there any way to get input type=date value to javascript date function?
I have used in HTML:
<input type=date ng-model="dueDate">
<input type="time" ng-model="dueTime">
<button class="button button-block" ng-click="upload_duedates(dueDate, dueTime)">Add duedates</button>
In controller inside upload_duedates function I am getting this:
dueDate = Thu Jun 24 1999 00:00:00 GMT+0530 (India Standard Time)
dueTime = Thu Jun 24 1999 00:00:00 GMT+0530 (India Standard Time)
But I have to change this date format to something like:
dueDate = 24/01/1999 or 24-jan-1999(only dd, mm, yyyy)
dueTime = 00:00:00 (only HH:mm:ss)
Is there any filter/directives in angularjs or any way to solve this?
Upvotes: 1
Views: 564
Reputation: 2134
There are many source in the web to show that. E.g. http://www.angulartutorial.net/2014/04/date-filtering-and-formatting-in.html
Upvotes: 1