Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 31)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

CBSubs date substitution field - raw mismatch with formatted value

  • fdinkler
  • fdinkler
  • OFFLINE
  • Posts: 217
  • Thanks: 27
  • Karma: 0
1 year 9 months ago #333069 by fdinkler
Each Plan has a number of CB fields populated at subscription time.
Two of these fields use the same substitution value but are formatted differently.

cb_subscr_expdate = [SUBSCRIPTION_EXPIRY_DATE]
cb_mbrship_exp_date = [cb:date format="Y-m-d" date="[SUBSCRIPTION_EXPIRY_DATE]"

In the user profile, these values are always different by one day.
Example:
The raw substitution field cb_subscr_expdate = "04/18/2023"
the date formatted field cb_mbrship_exp_date =   04  |  17  |  2023     (displayed as a date field, as expected)

This is the case for all users.
FYI - I use the text field for external reporting, and the date field for expiration notices 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 9 months ago #333075 by krileon
[SUBSCRIPTION_EXPIRY_DATE] has timezone offset applied to it since it's meant to be used for visual purposes. All of the date substitutions to. If you need raw values you either need to get them from the database or use CB Auto Actions to set the fields values since you'll have access to the raw data there. Example as follows.

Global
Triggers: onCPayUserStateChange
Type: Field
User: Automatic
Access: Everybody
Field
Field: cb_subscr_expdate
Operator: Set
Value: [var9_expiry_date]

var9 in this trigger is the subscription object, which you'll have access to all of its information in _cbsubs_subscriptions. Being raw values they won't be impacted by timezone offset and they'll be output as database safe format of 0000-00-00 00:00:00.


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.

  • fdinkler
  • fdinkler
  • OFFLINE
  • Posts: 217
  • Thanks: 27
  • Karma: 0
1 year 9 months ago #333079 by fdinkler
Kyle - 
Sorry, I'm not getting your reply.
Perhaps a better title for this posting is "difference between unformatted and formatted value"

I'm using the same data source [SUBSCRIPTION_EXPIRY_DATE] 

Whether it is adjusted for timezone offset, or not, why would that result in a different value when it's formatted as a date versus not?
Thanks,
Fred

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 9 months ago #333080 by krileon
[SUBSCRIPTION_EXPIRY_DATE] is always formatted. It will always have timezone offset applied.

Whether it is adjusted for timezone offset, or not, why would that result in a different value when it's formatted as a date versus not?

Date fields and [cb:date] apply timezone offset. Date fields at least can be configured not to offset though. So in one of those you have it offset twice. It's best to store as a raw value then let the date field itself offset though.


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.

  • fdinkler
  • fdinkler
  • OFFLINE
  • Posts: 217
  • Thanks: 27
  • Karma: 0
1 year 9 months ago #333081 by fdinkler
Thanks for the clarity.
My goal is to store [SUBSCRIPTION_EXPIRY_DATE] as a date field in the member profile to support mailing notices in AcyMailing
Each Plan integration/CB Field section has that feature.
Being off by a day isn't a killer, but the optics are bad.

Is there a cb:date format string that corrects the problem? 
Thanks
Fred

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48630
  • Thanks: 8307
  • Karma: 1446
1 year 9 months ago #333082 by krileon
As explained above use CB Auto Actions. This will give you the raw database value that won't be offset in any way. You can then store that to a datetime field and can turn off timezone offset in your datetime field. This will give you a completely accurate expiration date for purposes like that.

Your alternative is store [SUBSCRIPTION_EXPIRY_DATE] to a text field leaving it as is and that will be only timezone offset once to the users timezone so that would be accurate in regards to themselves.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum