SimeonC / md-date-time

Depreciated see
http://simeonc.github.io/sc-date-time
MIT License
174 stars 33 forks source link

mindate parameter doesn't work #26

Closed brunoaduarte closed 9 years ago

brunoaduarte commented 9 years ago

HTML: <time-date-picker ng-model="dateValue" mindate="{{minDate}}"></time-date-picker>

JS: $scope.minDate = new Date(); Also tried: $scope.minDate = moment(); $scope.minDate = moment().toDate();

Am i doing something wrong here ?

SimeonC commented 9 years ago

Hmmm, ok, that's interesting. Apparently just using {{minDate}} when minDate = new Date() outputs the date with quote marks around it...

For now you can fix this by adding a date filter like so: {{minDate | date}}. I don't think this is a bug with the date-time-picker as such.

SimeonC commented 9 years ago

Moving forward I've changed the repo as it's not so much "material" (md-) specific, so going forward any issues should be brought up in https://github.com/SimeonC/sc-date-time.

If my above comment doesn't fix the issue to your satisfaction let me know over there.

brunoaduarte commented 9 years ago

Hi @SimeonC , unfortunately it didn't fixed the problem,

attrs.$observe('mindate', function(val) {
    if ((val != null) && angular.isDate(val)) {
         return scope.restrictions.mindate = val;
    }
});

When mindate="{{minDate}}" -> val = ""2015-09-16T15:29:03.330Z"" When mindate="{{minDate | date}}" -> val = "Sep 16, 2015"

The problem is that the code expects a date object.

brunoaduarte commented 9 years ago

Nevermind, i updated to "scDateTime" and it worked. Thanks !