Using HTML5 datetime input types
Formerly, AngularJS was limited to using antiquated input field types in forms. The 1.3 AngularJS release added the AngularJS field and model support for HTML5 date and time types, which will gracefully degrade when used on older browsers.
How to do it…
With AngularJS 1.3, your application is now able to bind to the date and time HTML5 input types while preserving their native data format.
The <input type="date"> type
The <input type="date">
date input type binds to a JavaScript Date
object and extracts only the date from the Date
object, ignoring the time component by letting it go unmodified (it will not be forced to midnight). The string value for the date October 31, 2014 would be 2014-10-31
.
The <input type="datetime-local"> type
The <input type="datetime-local">
date input type binds to a JavaScript Date
object and associates it with a time zone (by default, the browser time zone). The string value for 10:30 P.M. on October 31, 2014...