Is there a way in angular JS to get Timestamp from a date obtained by a form?
<label for="start">From:</label>
<input type="date" ng-model="startDate" />
What will I have to write in the directive to transform this data? I didn't find anything about this particular issue, Regards
Since you are using input type as date, the string in model should be compatible with Date
object in javascript. So you can do
var timestamp = new Date($scope.startDate).getTime()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With