Current Year in Graph

By: Mo Adam | Asked: 12/20/2022
ForumsCategory: How-toCurrent Year in Graph
Mo Adam asked 2 years ago
I wan to show a graph for current year records, so using below short code how to to adjust it to current year.

[frm-graph fields="x" y_less_than="2016-01-01"]
1 Answers
Bobby Clapp answered 2 years ago

Presuming you want within the year use both parameters in the shortcode as follows:

[frm-graph fields="x" created_at_greater_than="Y-m-d" created_at_less_than="Y-m-d"]

It has to be Y-m-d format. So maybe:

[frm-graph fields="x" created_at_greater_than="2022-01-01" created_at_less_than="2022-12-31"] for 2022

Mo Adam replied 2 years ago

Thanks @Bobby, But this will require a change on yearly basis. I was looking for a code like (Current Year) or "Year" So it will change natively without interaction from my side

Bobby Clapp replied 2 years ago

Try this:

[frm-graph fields="x" created_at_greater_than="[date format='Y']-01-01" created_at_less_than="[date format='Y']-12-31"]

This would pull the current year if the last option shown here also works with the graph code:
https://formidableforms.com/knowledgebase/filtering-entries/#kb-by-date

Mo Adam replied 2 years ago

It doesn't work from my side. They recognize the [ .. ] as faulty shortcode

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