Parses date/time from input using moment
Obtain module
$ bower install --save angular-moment-inputAdd module dependency to angular app
angular.module('...', ['angular-moment-input'])Use directive ng-moment-input (together with an ng-model)
<input ng-model="..." ng-moment-input="config">The config object is optional. The following keys are supported:
-
formatsAn array of moment.js formats. The first one is used for rendering the model value. All formats are used for parsing. Defaults toYYYY-MM-DD. -
strictEnable/disable strict parsing. Defaults totrue. -
momentThe moment parse function to use. Specifymoment.utcfor parsing in UTC mode. Defaults tomoment.