Closed pety-dc closed 4 years ago
@pety-dc ,
That's by design. We try and standardize the date formats going into the CRM classes, since plugins use all sorts of unusual date formats, and a Unix timestamp is the most standard thing.
If you look in WPF_Mautic
for example you'll see it has its own format_field_value()
which converts the timestamp into Y-m-d before it's sent over the API.
If you want to send the date as a string instead, and bypass that filtering, you can also change the "type" dropdown on the Contact Fields list in the WPF settings from "date" to "text". Then it won't be filtered.
@verygoodplugins
I understand what you are trying to do here, and I agree that it's ACF that stores dates in a sortof non-standard format (Ymd) I just wanted to notify this uncompatibility.
If I bypass the date filterint by setting the sync type from date
to text
, it won't convert the date stored in Ymd
format assuming that it's a timestamp, but it also doesn't convert it to Y-m-d
Anyway, as I noticed that a few data-transformations can take place in format_field_value
. For example the timestamp
=>Y-m-d
is default. So if the WP plugin stores dates as timestamps it gets transformed to Y-m-d format. But if the WP plugin stores date in Y-m-d format, it gets sent as is.
I wonder where the backwards-transformation should take place? So when you load a contact's data from the CRM API and it sends a date in Y-m-d
format, where should the Y-m-d
=>timestamp transformation take place? How does WP fusion know whether and how it should transform a data it got from the CRM API to the format a WP plugin stores it?
@pety-dc ,
Ah, I see what you're saying. Sorry, I misunderstood the first time.
The check for is_numeric()
in format_field_value()
is treating the Ymd date as if it's already a timestamp. And then when it's converted into Y-m-d in WPF_Mautic it's the wrong date. Right?
I can update the ACF integration so it sends the dates as Y-m-d or ISO_8601 or something so it can be converted correctly. Will try and get that into today's update.
That's fixed now. Will be released today in v3.27.1.
Thanks! It's very reassuring that you are reacting to reported problems agile
I tried to add a
date
field withAdvanced Custom Fields
ACF stores dates internally in
Ymd
format WPfusion on the other hand converts the value of a date/picker type field to time if the value is numeric in theformat_field_value
method:This results in a wrong date. This Probably affects every crm (unless override_filters is true)