# End of month Datetime Value processing Bug?

**URL:** <https://community.appfarm.io/t/end-of-month-datetime-value-processing-bug/507>\
**Category:** Ask the community\
**Created:** [May 31, 2023, 12:44pm UTC](https://community.appfarm.io/t/end-of-month-datetime-value-processing-bug/507 "2023-05-31T12:44:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sondre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/sondre/32/105_2.png) [@Sondre](https://community.appfarm.io/u/Sondre)\
**Post date:** [May 31, 2023, 12:44pm UTC](https://community.appfarm.io/t/end-of-month-datetime-value-processing-bug/507/1 "2023-05-31T12:44:17Z")

</div>

Hey,  
This

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/bdf0c65e180f98c61a5d872d50ca71192cc36265.png)

gives this date 5 min ago

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/405929a9e20ef38f39abd7f19bd10bc3633372d9.png)

And this

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/ad9880d0dc49adcfa8da930cb6cca1e581ee5be0.png)

gives this  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/56636c4be3d8c67ecae6408774f79a163cd37693.png)

From my understanding this should give me start and end of april, however today it gives may and yesterday it gave april (the action ran without closing orders yesterday but closed today).

So i think the value processer is buggy at end of month or date is 31.

---

<div class="post-metadata">

**Author:** ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)\
**Post date:** [June 2, 2023, 1:11pm UTC](https://community.appfarm.io/t/end-of-month-datetime-value-processing-bug/507/2 "2023-06-02T13:11:08Z")

</div>

Hi! I believe this is in fact correct (not a bug) based on the screenshots 😉

31.05 at 12:35 you say “Go to start of day”. That gives 30.05 22:00Z. Subtracting 1 month from this gives 30.04 22:00Z, which is the first of may in CET time… So, when performing that operation in CET time, you say “go to end of the month for the first of may”, which is 31st of may.

---

<div class="post-metadata">

**Author:** ![Sondre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/sondre/32/105_2.png) [@Sondre](https://community.appfarm.io/u/Sondre)\
**Post date:** [June 2, 2023, 1:23pm UTC](https://community.appfarm.io/t/end-of-month-datetime-value-processing-bug/507/3 "2023-06-02T13:23:27Z")

</div>

I see, so subracting one month is in reality subtract 30 days. In my opinion subtract one month should give you the previous month regardless of the start date of current month. As it stands it is a bit misleading not getting to previous month when subtracting one 🙂

Call it a feature request then!

---

<div class="post-metadata">

**Author:** ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)\
**Post date:** [June 2, 2023, 2:23pm UTC](https://community.appfarm.io/t/end-of-month-datetime-value-processing-bug/507/4 "2023-06-02T14:23:24Z")

</div>

Hi,

It is in fact subtracting 1 month excactly. Both 31st of May at 10:00 and 30th of May will take you to 30th of April since April only has 30 days.

In fact, if you yse `Date Now` in your above screenshots instead of `Date Today` it will be correct in all scenarios.

This behaviour is defined by momentjs, which we use behind the scenes.

---

<div class="post-metadata">

**Author:** ![Sondre](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/sondre/32/105_2.png) [@Sondre](https://community.appfarm.io/u/Sondre)\
**Post date:** [June 2, 2023, 2:35pm UTC](https://community.appfarm.io/t/end-of-month-datetime-value-processing-bug/507/5 "2023-06-02T14:35:52Z")

</div>

Aahhh my bad😊 thank you!
