You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
The ability to use a Date object as the model for a date input is really convenient. As documented, min/max work when given a date string but is there any particular reason why the min/max attributes couldn't support date objects as well?
This sort of thing has come up before, with regards for ng-true-value (among others) for checkboxes/etc. When using a single attribute, you don't want it to sometimes be a constant string, and sometimes a value to be parsed.
I don't necessarily think it's a problem to use a parsed value, particularly for dates, because I think it's unlikely people want to write out a constant date in their markup.
It may not be too late to change this API, I'm not sure. What do you think @tbosch, is that worthwhile? String-format dates could still be supported via min="'03/17/1988'" or something
Yeah, I think it's fine to just use strings. I only brought it up because initially I had assumed that using date objects for min/max would work. After a couple minutes of trying to figure out why my example wasn't working, it wasn't until I took a closer look at the documentation that I realized my assumption was incorrect.
Activity
caitp commentedon Mar 19, 2014
This sort of thing has come up before, with regards for ng-true-value (among others) for checkboxes/etc. When using a single attribute, you don't want it to sometimes be a constant string, and sometimes a value to be parsed.
I don't necessarily think it's a problem to use a parsed value, particularly for dates, because I think it's unlikely people want to write out a constant date in their markup.
It may not be too late to change this API, I'm not sure. What do you think @tbosch, is that worthwhile? String-format dates could still be supported via
min="'03/17/1988'"or somethingscottopherson commentedon Mar 19, 2014
Yeah, I think it's fine to just use strings. I only brought it up because initially I had assumed that using date objects for min/max would work. After a couple minutes of trying to figure out why my example wasn't working, it wasn't until I took a closer look at the documentation that I realized my assumption was incorrect.
tkrotoff commentedon Jun 17, 2015
+1, I have to write this:
This way it is compliant with Chrome datepicker: the user cannot select a date before/after min/max.
I would have expected to write:
with ng-min/max taking care of generating min/max attributes if the date is not undefined or null.
Same for
<input type="time">,<input type="datetime-local">...