# How to restrict dates to only greater than the one selected

**URL:** https://discourse.nodered.org/t/how-to-restrict-dates-to-only-greater-than-the-one-selected/46882
**Category:** Dashboard
**Created:** [9 June 2021 01:05 UTC](https://discourse.nodered.org/t/how-to-restrict-dates-to-only-greater-than-the-one-selected/46882 "2021-06-09T01:05:20Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![JMJM](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@JMJM](https://discourse.nodered.org/u/JMJM)
#### Post date: [9 June 2021 01:05 UTC](https://discourse.nodered.org/t/how-to-restrict-dates-to-only-greater-than-the-one-selected/46882/1 "2021-06-09T01:05:21Z")

</div>

How can i make a pair of datepickers, where the first one i select makes it so the other one cant pick a date earlier than the one that is already picked?

Edit: preferably in a Form node, hotNipis solution works for individual datepicker nodes though

---

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [9 June 2021 01:34 UTC](https://discourse.nodered.org/t/how-to-restrict-dates-to-only-greater-than-the-one-selected/46882/2 "2021-06-09T01:34:42Z")

</div>

This way maybe

```auto
[{"id":"32423a30.627606","type":"ui_date_picker","z":"c0ddb509.b04f48","name":"","label":"select","group":"93fae10c.09faa","order":9,"width":0,"height":0,"passthru":false,"topic":"topic","topicType":"msg","x":390,"y":2800,"wires":[["56a8ab72.4dd374"]]},{"id":"56a8ab72.4dd374","type":"function","z":"c0ddb509.b04f48","name":"minimum check","func":"let m = flow.get('minimumDate') || 0\nif(msg.payload < m){\n msg.payload = m\n return [msg,null];\n}else{\n return [null,msg]\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":2800,"wires":[["32423a30.627606"],["df248e63.c0ddf"]]},{"id":"3118eafa.1a2656","type":"ui_date_picker","z":"c0ddb509.b04f48","name":"","label":"minimum","group":"93fae10c.09faa","order":9,"width":0,"height":0,"passthru":false,"topic":"topic","topicType":"msg","x":380,"y":2740,"wires":[["f88512.13234af"]]},{"id":"df248e63.c0ddf","type":"debug","z":"c0ddb509.b04f48","name":"DATE","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":2820,"wires":[]},{"id":"f88512.13234af","type":"change","z":"c0ddb509.b04f48","name":"","rules":[{"t":"set","p":"minimumDate","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":2740,"wires":[[]]},{"id":"93fae10c.09faa","type":"ui_group","name":"Default","tab":"6ff5405c.a8e6","order":1,"disp":true,"width":"6","collapse":false},{"id":"6ff5405c.a8e6","type":"ui_tab","name":"TEST","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

### Author: ![JMJM](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@JMJM](https://discourse.nodered.org/u/JMJM)
#### Post date: [9 June 2021 01:44 UTC](https://discourse.nodered.org/t/how-to-restrict-dates-to-only-greater-than-the-one-selected/46882/3 "2021-06-09T01:44:08Z")

</div>

thx a lot, i forgot to add that im looking for a form option preferably, if there isnt ill update the flow to use your solution

---

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [9 June 2021 01:47 UTC](https://discourse.nodered.org/t/how-to-restrict-dates-to-only-greater-than-the-one-selected/46882/4 "2021-06-09T01:47:55Z")

</div>

I cant see any ways to do it with form.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [9 July 2021 01:48 UTC](https://discourse.nodered.org/t/how-to-restrict-dates-to-only-greater-than-the-one-selected/46882/5 "2021-07-09T01:48:25Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
