[#6475] How do I make the auto-action condition string so it matches todays date?

7 years 2 months ago - 7 years 2 months ago #290801 by fribse2011
I need to compare todays date, with the date stored in the userprofile.
I've used this conditional:
[cb:parse function="time"][cb_birthday][/cb:parse] EQUAL TO [cb:parse function="time"][cb:date format="Y-m-d" /][/cb:parse]

The [cb_birthday] field is stored as Y-m-d?

With debugging I can see that it's very different from what I expected.

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

Please Log in to join the conversation.

7 years 2 months ago #290802 by fribse2011
Sorry, damned, I forgot that I need to exclude the YEAR, otherwise it will never match their birthday, dooh!

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

Please Log in to join the conversation.

7 years 2 months ago - 7 years 2 months ago #290804 by fribse2011
So now I'm looking into comparing the field to todays date, but how do I reformat the field for the comparison?
I tried
[cb:date format="m-d" /][cb_birthday]
and
[cb:parse [date format="m-d" /]][cb_birthday][/cb:parse]
and
[cb:parse date format="m-d" /][cb_birthday][/cb:parse]
and also
[cb:userdata field="cb_birthday" format="m-d" /]
even
[cb:parse function="date"][cb:userdata field="cb_birthday" format="m-d" /][/cb:parse]

EQUAL TO [cb:parse function="date"][cb:date format="m-d" /][/cb:parse]

None of these works :-(

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

Please Log in to join the conversation.

7 years 2 months ago #290833 by krileon
You need to parse it into month and day then compare it to current month and day. Below should work.

[cb:parse function="date" date-format="m-d" time-format=""][cb_birthday][/cb:parse] Equal To [cb:date format="m-d" /]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

7 years 2 months ago #290841 by fribse2011
Hmm, nope, that gave me this in the debugger:
Betinget 2 fejlede for 75: [cb:parse function="date" date-format="m-d" time-format=""]1968-07-19[/cb:parse] Lig med 01-30

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

Please Log in to join the conversation.

7 years 2 months ago - 7 years 2 months ago #290849 by krileon
Hmm, doesn't seam to like time-format being empty yet that's the only way to turn off time parsing. Ok, implementing a new parameter to turn off time and that should solve that. You'll use the below in next build.

[cb:parse function="date" date-format="m-d" time="false"][cb_birthday][/cb:parse]

Was able to confirm it formats it correctly now using the above. This should be available later today or early tomorrow.

forge.joomlapolis.com/issues/6475


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: fribse2011

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.206 seconds

Facebook Twitter LinkedIn