# Only pass date same or older

**URL:** <https://discourse.nodered.org/t/only-pass-date-same-or-older/78017>\
**Category:** General\
**Created:** [28 April 2023 17:20 UTC](https://discourse.nodered.org/t/only-pass-date-same-or-older/78017 "2023-04-28T17:20:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![madmax](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@madmax](https://discourse.nodered.org/u/madmax)\
**Post date:** [28 April 2023 17:20 UTC](https://discourse.nodered.org/t/only-pass-date-same-or-older/78017/1 "2023-04-28T17:20:05Z")

</div>

Hello!

Is it possible to only pass on the flow if the date is the same?

I have several payloads where there are dates in payload.date.

2023-05-25  
2023-05-12  
2023-05-01  
2023-05-04  
2023-04-25  
2023-03-10  
2023-04-25  
2023-05-26  
2023-05-22  
2023-04-28

Is it possible to only pass on your payload if the date is the same or older.

eg. today is 2023-04-28 then the following should continue.

2023-04-28  
2023-04-25  
2023-03-10  
2023-04-25

I hope someone can help me.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 April 2023 17:34 UTC](https://discourse.nodered.org/t/only-pass-date-same-or-older/78017/2 "2023-04-28T17:34:20Z")

</div>

If these dates are string as you have shown, then a simple, less than or equal `<=` to comparison is perfectly viable. You can use a switch node for that.

---

<div class="post-metadata">

**Author:** ![madmax](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@madmax](https://discourse.nodered.org/u/madmax)\
**Post date:** [28 April 2023 17:40 UTC](https://discourse.nodered.org/t/only-pass-date-same-or-older/78017/3 "2023-04-28T17:40:33Z")

</div>

Hello!

Thank you for your answer.

Do you have an example?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [28 April 2023 17:56 UTC](https://discourse.nodered.org/t/only-pass-date-same-or-older/78017/4 "2023-04-28T17:56:25Z")

</div>

@madmax

As per @Steve-Mcl suggestion, In a switch node.

set the property to an expression.

```auto
$millis() >= $toMillis(payload.date)	

```

`$millis` = Now in ms  
`$toMillis` = Converts a timestamp to ms

you can then react accordingly

![Screenshot 2023-04-28 at 18.54.10](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/f/efed7ba8e187f4d7f36746d508c042838f73575b.png)

---

<div class="post-metadata">

**Author:** ![madmax](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@madmax](https://discourse.nodered.org/u/madmax)\
**Post date:** [28 April 2023 18:27 UTC](https://discourse.nodered.org/t/only-pass-date-same-or-older/78017/5 "2023-04-28T18:27:38Z")

</div>

Thank you for your answer works great.

---

<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:** [12 May 2023 18:27 UTC](https://discourse.nodered.org/t/only-pass-date-same-or-older/78017/6 "2023-05-12T18:27:39Z")

</div>

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