g00fy- / angular-datepicker

calendar and datepicker directives for angular
MIT License
722 stars 421 forks source link

Unable to add minDate #314

Open chaituValKanO opened 7 years ago

chaituValKanO commented 7 years ago

I am trying to ad min date(using new Date()) to my calendar, but its not reflecting. My html tag is

.

in JS file i have initialized minDate = new Date() and startDate = new Date(). The start date is shown in the input tag but minDate is not working. Am i missing something?

I have included angular-datepicker/dist/index.js and angular-datepicker/dist/index.css.

cjk101812 commented 7 years ago

TypeError: date.format is not a function at setMin (http://localhost:3000/bower_components/angular-datepicker/dist/angular-datepicker.js:748:37) at link (http://localhost:3000/bower_components/angular-datepicker/dist/angular-datepicker.js:762:9)

KumarGeoSpark commented 7 years ago

I also need help with this

davidda commented 7 years ago

You'll have to post the html tag and relevant excerpts from your controller in order to see what is going on.

brunowego commented 7 years ago

Just do something like this:

$scope.dates = {
  minDate: this.moment().add(31, 'minutes'),
  maxDate: this.moment().add(1, 'month'),
};
input.form-input(type='text', name='scheduled_at', ng-model='item.scheduled_at', date-time, min-date='dates.minDate', max-date='dates.maxDate', validation='required')
KumarGeoSpark commented 7 years ago

Thank you

On Tue, Dec 27, 2016 at 10:45 PM, Bruno Wego notifications@github.com wrote:

Just do something like this:

$scope.dates = { minDate: this.moment().add(31, 'minutes'), maxDate: this.moment().add(1, 'month'), };

input.form-input(type='text', name='scheduled_at', ng-model='item.scheduled_at', date-time, min-date='dates.minDate', max-date='dates.maxDate', validation='required')

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/g00fy-/angular-datepicker/issues/314#issuecomment-269354544, or mute the thread https://github.com/notifications/unsubscribe-auth/AXTKzXNpYFiLpMgaoziIp_9IE2Jj8iPxks5rMUeUgaJpZM4LHxIS .

-- Regards, Kumar Sabyasachi Padhi ( FullStack Developer)

biswajitpanday commented 7 years ago

Use moment(). This is must. $scope.minDate = { moment() } <input type="datetime" date-time ng-model="minDate" view="date" auto-close="true" min-view="date" format="ddd, MMM DD, YYYY" min-date="minDate">