Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict selection and navigation #99

Open
Vishwaas opened this issue Jul 10, 2017 · 2 comments
Open

Restrict selection and navigation #99

Vishwaas opened this issue Jul 10, 2017 · 2 comments

Comments

@Vishwaas
Copy link

hi
Is there a way to restrict users such that they will not be able to selected older dates than the current day and also prevent them from navigating to previous months and also prevent navigating programatically to prev months using center?

@Vishwaas
Copy link
Author

There is one way to restrict selection, how to restrict navigation though??

Restrict selection is below:

{{#dp.content class="dropdown-menu demo-datepicker-small"}}
      {{dp.nav}}
      {{dp.days minDate=twoDaysAgo}}
    {{/dp.content}}

twoDaysAgo: computed(function() {
    return moment().add(-2, 'days');
  })

@cibernox
Copy link
Owner

cibernox commented Jul 10, 2017

If you pass onCenterChange=(action "someAction"), you can inside that action check if the previous month is invalid and just do nothing. You can also pass your own custom calendar.nav component that disables the button if the previous/next is not a valid one.

Both approaches are fine. Perhaps I'd prefer the second. The component is extremely simple: https://github.com/cibernox/ember-power-calendar/blob/master/addon/templates/components/power-calendar/nav.hbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants