Calculation using dates

By: Charl Van Niekerk | Asked: 05/04/2025
ForumsCategory: How-toCalculation using dates
Charl Van Niekerk asked 2 weeks ago

Hi people,

Need some help... - maybe this is a rookie question.

Im trying to create a birthday list in a calendar.

Here is the logic:
If the user enters 1 Feb 2010, the formula will replace 2010 with 2025, resulting in 1 Feb 2025. Now we can display all the birthdays in in year with a popup showing the correct birth date.

So I have date text field - Field A in a form.

I have a second text field -Filed B. this is the field calendar would use to show all birthdays converted to current year. The value of the text field is [57 format="d-m-"] [date format="Y"]. This should show 2025-02-01. 57 is reference to Field A.

I get the following error "unexpected identifier format" [57 format='d-m-'] 2025

What could be the issue?

Help would be greatly appreciated.

 

1 Answers
Rob LeVineRob LeVine Staff answered 2 weeks ago

You wrote "date text field". There is no such thing. It's either a date field or a text field. If 57 is a text field, the "format" parameter won't work, so I assume that's the issue.

Charl Van Niekerk replied 2 weeks ago

Hi Rob, thanks for your reply - "Field A"or 57 is definitely a date-field, verified it.

Charl Van Niekerk replied 2 weeks ago

Thanks Rob, I have noticed that when using math, it denotes to a Unix format that now entails a complicated conversion formula, but will investigate further, may also try shortcode/javascript. Just do not know how dynamic those implementations are, for example if there is a manual year update into field b, then that will not work in a 2026 query.

Just a quick update - in a view/detailed page the syntax [57 format="Y-m-d"] works like a charm, but not in a form.
Do not know if this is then perhaps a bug?

Rob LeVineRob LeVine Staff replied 2 weeks ago

I've never understood why, but calculations for date fields are a different beast. https://formidableforms.com/knowledgebase/datepicker-options/#kb-date-calculations
I've tried to think of different ways to solve your problem with native features but since you don't know at design time how many years from this year the dates are, I don't one. I generally just call it a day and use some really simple jQuery to handle the situation.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right