# Leap Year and "Dates: Adjust a Date" Action

Greg_703914
Posts:

**14**I am curious if I am not thinking about how to adjust a date correctly or there is a problem because the number of days in a year can vary due to leap year.

In my instance the calculated date was supposed to be 2019-05-01. The calculated date was one day off. The calculation is that it takes an existing date (which in this case was 5/1/2020) and is supposed to calculate 1 year previous but I only have the option of days so I chose 365.

How can I setup a formula to properly calculate a date that is 1 year previous that accounts for the leap year ( Which I am assuming is the issue here)? I am misunderstanding how it is calculating days in the **Dates: Adjust a date** action?

Tagged:

0

## Comments

262admin@Greg_703914 To clarify what happened, I added an example action setup below. The output was 2019-05-02, but the expected output in your case was 2019-05-01. Is that correct?

14That is correct.

262admin@Greg_703914 I submitted a new Idea for offering more "Unit" options that I recommend upvoting.

Dates, Date & Time Actions - Offer More "Units"https://community.pushbot.com/discussion/989

Since this is not available today, I will work on obtaining a formula you can use to address your case. I will share the formula with you here shortly.

262admin@Greg_703914 Using

Field: Field Formulas, you can reuse the Javascript printed below to get 2019-05-01 (instead of 2019-05-02). The only place where you need to make an edit is in`fields['input-field']`

. This is where we reference the date field in all lowercase letters and dashes in place of spaces.14This worked quite well. In fact, I was able to remove a second step in my process that formatted the date after it was calculated. This solution allows me to both calculate and format the dates format in the same step. Thank you.