Entry Date Format in Zapier [RESOLVED]

I’m using Zapier to send data to Google Spreadsheets.

I’m having an issue where the entry date seemingly comes in as a valid date format when sending test data from Zapier. However when real data gets pushed it gets formatted as “October 23rd at 12:30pm”. I need the dates formatted in a valid way because I’m using them to create a detailed report and the Sheets formulas fail if the date is not in a valid format.

I tried to use Regex in Zapier to remove the invalid parts (rd at). However it seems to ignore that formatting and passes it anyway. I’m trying to deduce whether this is a Zapier issue or a GF issue.

Hey Nick. You can use the Gravity Forms logging to see what Gravity Forms is storing for that date and also see exactly exactly what the Zapier add-on is sending.

If you need to you can use the gform_zapier_field_value filter to modify what the add-on sends to Zapier: https://docs.gravityforms.com/gform_zapier_field_value/#4-format-date-field-value

Hmm… I didn’t realize the Entry Date was stored like that, I mean it makes sense. So do I need to target date_created or is just using $field->get_input_type() == 'date' enough?

I am not sure how it’s stored actually. That’s why I recommend logging. Then you can see what Gravity Forms stores and also what the Zapier add-on is sending. As far as which date you need to target, it depends on which field you are mapping to Zapier. That would be the one you need to target.

Got ya, I’m sending the Entry Date that GForms creates for every entry. I’ll figure it out and post my code for future generations.

1 Like

Ok upon further digging, it appears that the function you sent me will not fix the issue. The field_value filter only applies to user submitted fields and not the entry properties. Whomp Whomp Whomp (Sad Trombone)

However, there is away to do this, but it requires manipulating the core Zapier Add-on code. This actually may be something you might suggest as a change to the engineers as it’ll make sending the entry_date more flexible to the Zapier API.

The Issue
As stated above, GForms sends the entry_date in a non-valid format to Zapier. Zapier does not recognize this as an actual date and rather just a string, therefore any manipulation of the date format is impossible without first using Regex (which even with my testing failed… although it should have worked).

The Solution
In the sample data that is initially sent to Zapier for testing purposes the format is set properly and is a valid date/time format.

– gravityformszapier/zapier.php line 1302 - 1305 –

'date_created' => array( 'label' => esc_html__( 'Entry Date', 'gravityforms' ), 'sample_value' => gmdate( 'Y-m-d H:i:s' ), ),

Outputs as 2019-10-24 17:20:49

This is the reason the sample data validates in testing mode when building workflows in Zapier.

However, when the data is actually processed the Add On formats the entry_date to be user friendly and not API friendly.

– gravityformszapier/zapier.php line 788 - 790 –

if ( $property_key == 'date_created' || $property_key == 'payment_date' ) {
	   $value = GFCommon::format_date( $value, false );
}

Outputs as October 24, 2019 at 9:57 am

The easiest method to fix is this is to simply remove lines 788-790. I ran a test with those lines removed and it operated as expected. There really isn’t a reason to format the entry_date that way, it’s useless to the API and is only good if you want to read the date in a clever humany way, machines aren’t humans… yet. lol.

Hopefully you’ll consider making this change, if not I’ll just be sure to tell my team to not update the Add On as to not break the functionality.

1 Like

Hi Nick. I opened a ticket for this with the dev team and I will let you know what happens.

1 Like

Thank you!

1 Like

You could always use the Zapier Formatter to alter the format of the date before adding it into the spreadsheet.

1 Like

That costs an action in Zapier for no reason and the date coming in is not in a valid format that Zapier even recognizes. You have to regex the format first to remove the extra bits then send it to the formatter. It’s all a bit too complicated for something that should just work out of the box.

Also as I mentioned, the engineers made it so the testing data works properly but real entries do not. At the very least those two values should match so that you can test properly.

1 Like

Fair enough, we used to use Zapier for this but due to limits we switched to this plugin;

Hi Nick,

Just wanted to let you know that we just published version 3.2.1 of the Zapier add-on that contains a patch to remove the date formatting to our downloads page as an interim build. After reviewing a similar ticket we had come into support regarding the exact same issue, I came to the same conclusion you did regarding the date formatting, so the update and patch is essentially just removing the lines you mentioned earlier.

You can grab 3.2.1 of the Zapier add-on from the downloads page in your account using the following steps:

Can you try updating to the latest build of the Zapier add-on available from the downloads page, follow the steps below.

NOTE: Do NOT use the Uninstall [plugin] button in the Forms > Settings area - this will remove your data.

The steps below will only remove the plugin files so you can replace them with the newer version.This does NOT touch your data.

  1. Select the “Deactivate” option for the plugin you’re trying to update
  2. Select the “Delete” option for the plugin you’re trying to update
  3. Answer yes when prompted to delete the files. This step deletes the plugin’s folder and the files inside.
  4. Select the option to “Add New” plugin
  5. Select “Upload”
  6. Browse to the location where you saved the newly downloaded zip file and select it
  7. Click “Install Now”. You should see the message “Plugin installed successfully.” This step recreates the plugin’s folder and the files inside.
  8. Click “Activate Plugin”

Best,

2 Likes

Excellent, Thank you so much! we’ll get all of our sites updated.

1 Like