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
527 stars 229 forks source link

hours-start option not working #234

Open fabiomor opened 6 years ago

fabiomor commented 6 years ago

Hi, i'm trying to setup a timepicker for hours of the day but i can't manage to filter dynamically the start and the end of the hours of the day: The popup should be agnostic of the current day, just pick the given range of hours minutes of the day (in fact, i hould remove the title of the current day in the default timepicker dialog).

Here is an example:

<input class="form-control" moment-picker="sg.timepicker" format="HH:mm" hours-start="10" ng-model="sg.timepicker" ng-model-options="{ updateOn: 'blur' }">

Thanks in advance :)

ioanabote commented 6 years ago

Had the same issue, the only way I could get it to work is by setting these values in the provider config options like this:

.config(['momentPickerProvider', function (momentPickerProvider) { momentPickerProvider.options({ minutesStep: 15, hoursStart:7, hoursEnd:22 }); }])

eddiebrowne commented 5 years ago

I was able to achieve this by using min-date and max-date attributes on the moment-picker control. I set the format attribute to 'HH:mm' and the min/max values to the times I wanted, e.g., "9:30", "14:25".

You can edit this plunk to see it in action.

lehos commented 5 years ago

fixed in #287