Skip Navigation

[Resolved] Custom field date is changed from January 9, 2017 to 20170109 on front end

This support ticket is created 7 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 32 replies, has 2 voices.

Last updated by seanN-5 7 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#478249

Trying to understand the date format and where these items are set. In test site we were using the Custom post type, Advanced Custom Fields and Toolset. The Events were created manually.

In the production site:

Events are created in NEON CRM and downloaded to a xml file via api.
XML file is imported into Advanced Custom Fields via plugin WP All Import and Events are created based on import.

As far as dates being set here is what I have:

Date Setting in WordPress is set to: Ymd
Date setting in Advanced Custom Field start_date field is set to: Ymd
WP All Import does not set a date. It just pulls info over from xml file and places in custom post type advanced custom fields.

In the XML file looks like date is set to: 2017-01-14
But once its placed in the start_date field in a event post it is set to: 20170114

-----

Any idea of where the date setting is off?

Thank you.

#478254

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - Please check this post date:
=> hidden link

The date is showing wrong. Please do something so that right date is imported to start and end date field and then I'll check further.

#478263

On the post you referenced I am seeing:

Start Date: 22221212
End Date: 22221212

These are the dates set in the NEON CRM system. December 12, 2222. These are internal post items on their CRM that are pulled over for now. Still trying to remove them from the api.

But if we look at the format of the two dates they are Ymd.
--

#478272

I went ahead and changed the status of two of the posts showing to Draft, and now only one event is showing. Seems like currently we're only pulling the events with a year of 2222.

As a test I changed another post to have a start year of 2222, and its showing.

#478276
test-vs-production-fields.jpg

Here is a screenshot of the test vs production fields as displayed in a custom post type event.

Format of start date and time seem to be the same.

#478288

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

That's good - Could you please setup few after events just like you did with test site so that we are sure that we are getting correct results.

#478298

Ok I created four After events.

1 & 2 I manually added in date and time.

3 & 4 I set the date and time throughs Date and Time picker.

#478300

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

But I can see only two events on page. I think events created using date picker is not displaying. That's why this is a mess. Which events should be considered?

#478301

Its set to show only three. I'm going to increase that.

I set after event 2 to draft and after event 3 showed.

#478302

I have it set to show 10 events.

Only events showing are those that have a start date of 22221212 or new events created.

#478306

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Great - thanks.

Could you please confirm that this view output returning expected results now?
=> hidden link

Do you want me to check any other view?

#478309

I added a new event called Before Event 1 with a start_date of Dec 21. It did not show (as expected). Next I changed the date to Jan 21 and it did show (as expected). Then changed it back to Dec 21, 2016 and once again not showing (as expected).

So new events created appear to be working.

Events that are imported in seem to be having the problem. But to test I'm going to delete all of the imported events and re-import them.

Can you see any difference in the start_date format between and item imported in and one created manually?

Manual: hidden link

Imported: hidden link

#478314

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check your database and check "start_date" postmeta key value for both the posts : Manual and imported.

I see that both posts have different values for "start_date" postmeta. It should be imported in the format in which its currently working for now.

#478336

OK. I can see that in the database its storing things differently. Manual post is 20170128 while imported posts are using the dash - 2017-01-28.

Next step is to figure out how to change the start_date on import to the database from Y-m-d to Ymd.

#478553

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - exactly. I think then automatically all things work. Please let me know if you need further help from this end.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.