# Date validation min date not working

**URL:** <https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367>\
**Category:** ionic-v1\
**Created:** [July 26, 2014, 3:03am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367 "2014-07-26T03:03:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![merf64](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@merf64](https://forum.ionicframework.com/u/merf64)\
**Post date:** [July 26, 2014, 3:03am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/1 "2014-07-26T03:03:56Z")

</div>

I’ve been playing around with this for an hour or so but can’t seem to get the min date validation working on a date input I have. This is the simple html I have:

```
<input type="date" ng-model="date" min="2014-07-25" required>

```

Any date I enter before the min causes the “ng-valid” class to be applied. Further, {{date}} is printing the date in exactly the format specified in the angular docs.

Related to this, is there any way to make it impossible to pick a date in the iOS datepicker that is before today? That would be ideal as well. Thanks!

---

<div class="post-metadata">

**Author:** ![saturn](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@saturn](https://forum.ionicframework.com/u/saturn)\
**Post date:** [August 11, 2014, 9:31pm UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/2 "2014-08-11T21:31:05Z")

</div>

Hi, i exactly have same problem, so i can’t do client-side date validation, can you help us ?

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [August 12, 2014, 5:52am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/3 "2014-08-12T05:52:36Z")

</div>

The “min” and “max” attributes are only there for form-validation.  
There is no better implementation on mobile devices for this new html5 feature, yet.

Or you are using 3 (yyyy, mm, dd) select inputs instead of the date picker.  
For that you could only provide valid values.

Greetz, bengtler

---

<div class="post-metadata">

**Author:** ![saturn](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@saturn](https://forum.ionicframework.com/u/saturn)\
**Post date:** [August 12, 2014, 6:49am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/4 "2014-08-12T06:49:25Z")

</div>

Thank you for your reply. Maybe i missing something, but i d’ont understand why it work like a charm (with safari on mac) on [https://docs.angularjs.org/api/ng/input/input[date]](https://docs.angularjs.org/api/ng/input/input%5Bdate%5D) and not on my ionic app ?

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [August 12, 2014, 7:08am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/5 "2014-08-12T07:08:28Z")

</div>

Yeah it is dependend how this thing is implemented in the browsers.  
It also works in Chrome very well.  
But you have to consider that safari and mobile safari are different things.

If you use type date, number or select boxes on mobile device the system default behavior is triggered (you see the iOS or Android datepicker… not the browser date picker).

It has nothing to do with ionic… only a mobile - non-mobile thing 😉

---

<div class="post-metadata">

**Author:** ![saturn](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@saturn](https://forum.ionicframework.com/u/saturn)\
**Post date:** [August 12, 2014, 9:42am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/6 "2014-08-12T09:42:43Z")

</div>

yes sure, only thing i can’t understand is why myForm.input.$valid work correctly with angular and not with ionic ?

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [August 12, 2014, 9:48am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/7 "2014-08-12T09:48:35Z")

</div>

I am using this in my template and it works.

Maybe you have another scope issue?

---

<div class="post-metadata">

**Author:** ![saturn](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@saturn](https://forum.ionicframework.com/u/saturn)\
**Post date:** [August 12, 2014, 10:42am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/8 "2014-08-12T10:42:29Z")

</div>

Maybe you can well understand my pb with this example (fork from angular Input[date] doc) with ionic :

> **[LuyJs](https://codepen.io/anon/pen/LuyJs)**
>
> Forked from \[A Non Ymous\](http://codepen.io/anon/)'s Pen \[kqAlv\](http://codepen.io/anon/pen/kqAlv/). Forked from \[Mike Hartington\](http://codepen.io...

but validation work correctly with angular only :

> **[Plunker](http://plnkr.co/edit/wjSouIdQIz9fBwrVAMwA?p=preview)**
>
> Created on Plnkr: Helping developers build the web.

---

<div class="post-metadata">

**Author:** ![bengtler](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/bengtler/32/98565_2.png) [@bengtler](https://forum.ionicframework.com/u/bengtler)\
**Post date:** [August 12, 2014, 10:51am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/9 "2014-08-12T10:51:52Z")

</div>

if you use [//ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js](https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js)  
(this is the last stable angularjs version)  
the output looks the same, for me…

Greetz, bengtler

---

<div class="post-metadata">

**Author:** ![saturn](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@saturn](https://forum.ionicframework.com/u/saturn)\
**Post date:** [August 12, 2014, 11:40am UTC](https://forum.ionicframework.com/t/date-validation-min-date-not-working/7367/10 "2014-08-12T11:40:12Z")

</div>

Ho yes you’ve right 😊 Thx a lot !  
So it’s due to angular version… hope this fix embed in 1.3 came soon in 1.2 branche
