indrimuska / angular-moment-picker

Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js.
http://indrimuska.github.io/angular-moment-picker/
MIT License
525 stars 227 forks source link

Ignore seconds? #212

Open karthikrock opened 7 years ago

karthikrock commented 7 years ago

Is there a way to completely ignore seconds (Minute view) ? I tried setting below:

    momentPickerProvider.options({
        secondsStep:   60
    });

still it shows the Minute view to select the only available option for seconds there which is "00" (top of the minute). Is there a way to only select the date and time with hours and minutes ?

ChrisGarber-Medlever commented 7 years ago

Yup, check out the builder: http://indrimuska.github.io/angular-moment-picker/#builder

You're looking for the max-view property. If add max-view="hour" to your picker or your defaults, this should give you the behavior you're looking for. Check out the documentation for more features.

shubhamkumarnayak commented 5 years ago

Yup, check out the builder: http://indrimuska.github.io/angular-moment-picker/#builder

You're looking for the max-view property. If add max-view="hour" to your picker or your defaults, this should give you the behavior you're looking for. Check out the documentation for more features.

Sorry, not working, I set the max-view to minutes but still it is showing the current minutes and seconds in the input after selection.

uhrias commented 5 years ago

Should be enough to set max-view="hour" and handle change event like this

<input moment-picker="fromDate" ng-model="myEvent.from" change="trimSeconds(myEvent.from)">

$scope.trimSeconds = function(momentTime){ momentTime._d.setSeconds(0); }