Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] date format using {cb}[substitutions]{/cb}

8 years 11 months ago - 8 years 11 months ago #272982 by gjvanwijk63
Hello

I set the date format in the general configuration panel to dd/mm/yyyy

All dates in all views show the good date format.

I also have an article in which I use some data fields by using the cb content plugin; so for instance {cb}[cb_birthdate]{/cb}

But now the date field is formatted yyyy-mm-dd

While the same date of birth field in profile view shows up as dd/mm/yyyy

How can I solve this?

Regards

Gert-Jan
Last edit: 8 years 11 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
8 years 11 months ago #273015 by krileon
Replied by krileon on topic date format using {cb}[substitutions]{/cb}
You're using a raw substitution. You need to use the following substitution usage if you want it to pass through field behavior and parse it into its formatted display.

[cb:userfield field="FIELD_NAME" /]

Please review the below substitution tutorial carefully.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb


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 or Create an account to join the conversation.

8 years 11 months ago #273037 by gjvanwijk63
Replied by gjvanwijk63 on topic date format using {cb}[substitutions]{/cb}
Ok, thx I'll check it out!!

Please Log in or Create an account to join the conversation.

8 years 11 months ago #273044 by gjvanwijk63
Replied by gjvanwijk63 on topic date format using {cb}[substitutions]{/cb}
Hi Krileon

I tried a couple of thinks but the problem isn't solved so far.

The first thing I did:

{cb}[cb_ag_ingangsdatum]{/cb} returns 2015-08-15

Like a explained in the first post I would like that date to be formatted 15/08/2015 That's also how it's configured in the common setup of CB.

So next I tried:
{cb}[cb:userfield field="cb_ag_ingangsdatum" /]{/cb} This returns just an empty field, nothing at all

Next I tried:
{cb}[cb:userdata field="cb_ag_ingangsdatum" /]{/cb} This returns the raw data again so 2015-08-15

Next I tried to format the field:
{cb}[cb:userdata field="cb_ag_ingangsdatum" format="d-m-Y" /]{/cb}

But this is probabaly wrong because it shows the above string in the output....

So what am I doing wrong??

Regards GJ

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
8 years 11 months ago #273106 by krileon
Replied by krileon on topic date format using {cb}[substitutions]{/cb}
You need to use [cb:userfield field="FIELD_NAME" /]. This assumes the field is even accessible to the viewing user; tab access, field set to display on profile, cb conditional conditions, etc.. all contribute to this. CB Content Bot substitutions by default are against the article owner and not the viewing user. If you need them against the viewing user you need to add user="#me" (example below) or configure CB Content Bot for that.

[cb:userfield field="FIELD_NAME" user="#me" /]


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 or Create an account to join the conversation.

8 years 11 months ago - 8 years 11 months ago #273114 by gjvanwijk63
Replied by gjvanwijk63 on topic date format using {cb}[substitutions]{/cb}

Hello Kyle,

I tried this code:

{cb}[cb:userfield field="cb_ag_ingangsdatum" user="#me" /]{/cb}

But it returns an empty field again. Raw data is working fine.


This is the complete source and in the attachment I'll show you the output.



<p>Hieronder staan jouw gegevens met betrekking tot jouw deelname aan <span style="color: #003366;">Sae</span><span style="color: #ff6600;">men</span> Collectief</p>
<p> </p>
<table style="width: 842px; height: 233px;">
<tbody>
<tr>
<td>Pakket </td>
<td style="width: 50%;">{cb}[cb_ag_pakket]{/cb}</td>
</tr>
<tr>
<td>Prijs per maand</td>
<td style="width: 50%;">{cb}[cb_ag_pakketprijs]{/cb}</td>
</tr>
<tr>
<td>Ingangsdatum</td>
<td style="width: 50%;">{cb}[cb:userfield field="cb_ag_ingangsdatum" user="#me" /]{/cb}</td>
</tr>
<tr>
<td>Einddatum</td>
<td style="width: 50%;">{cb}[cb_ag_einddatum]{/cb}</td>
</tr>
<tr>
<td> </td>
<td style="width: 50%;"> </td>
</tr>
<tr>
<td>Regus Businessworld Gold Card NL</td>
<td style="width: 50%;">{cb}[cb_ag_regus]{/cb}</td>
</tr>
<tr>
<td><span style="color: #003366;"> </span></td>
<td style="width: 50%;"> </td>
</tr>
<tr>
<td><span style="color: #003366;"> </span></td>
<td style="width: 50%;"> </td>
</tr>
</tbody>
</table>
<p> </p>
Attachments:
Last edit: 8 years 11 months ago by gjvanwijk63.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum