Skip Navigation

[Resolved] Custom date field problems after updating to Types 1.2

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 11 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 20 replies, has 4 voices.

Last updated by Toine 11 years, 1 month ago.

Assisted by: Caridad.

Author
Posts
#63424

Hi there,

I'm having a very weird problem regarding custom date fields.
I have over a 100 'event' posts, each with a 'event-start-date' custom field, all handled by the WP-types plugin.
Somehow after updating to WP-Types 1.2 some of the event's 'event-start-date' fields are not getting updated properly...

Within a loop I output the date's year to test what's going on and some of the post's simply loose their correct date:

echo types_render_field('event-start-date', array('format'=>'Y'));

The following dates turned into this after the 1.2 update:

November 10, 2012 > 1352505600
October 19, 2012 > 1350604800
October 18, 2012 > 1350518400
October 17, 2012 > 1350432000
July 30, 2012 > 1343606400
April 4, 2012 > 1333497600
January 1, 2012 > 1325376000

Very random, the rest of the event posts dates (like 90%) are displayed fine!
Any ideas what's causing this? A bug?

Thanks, Toine

#63854

Dear Toine,

Those are timestamps. The Types plugin stores dates as timestamps, but they should be properly formatted when displayed. I will send you an email requesting access, let me know if you don't receive it.

Regards,
Caridad

#63947

Hi Caridad,

I replied to your e-mail and gave you access to my website, did you receive it?

Cheers, Toine

#65470
years.png

Dear Toine,

I only see All, 2013 and 2012. Have you already fixed your problem?

Regards,
Caridad

#65478

Hi Caridad,

No I haven't fixed the problem yet.
I downgraded back to the previous plugin version 1.1.3.4 in order to keep my site running.
When you update the plugin, you will see what happens.

Cheers, Toine

#65582

Dear Toine,

I really wouldn't like to upgrade if the site is live. I will try and find more information first, what code are you using to read the dates?

Regards,
Caridad

#65896

Hi Caridad,

Ok I understand, I didn't really like doing that either...
This is my chunk of code that's getting the year numbers.

<ul class="year-filters filters row">
	<li><a href="#" data-filter="*"><?php _e('All', 'kbk'); ?></a></li>
  	<?php
  	$years = new WP_Query( array(
		'post_type' 	=> 'event',
		'post_status'	=> 'publish',
		'meta_key' 		=> 'wpcf-event-start-date',
		'meta_compare' 	=> '<',
		'meta_value' 	=> $today,
		'orderby' 		=> 'meta_value',
		'order' 		=> 'DESC',
		'nopaging' 		=> true
	));
	$prevyear = null;
 	while ($years->have_posts() ) : $years->the_post();
		$eventstartyear = types_render_field('event-start-date', array('format'=>'Y'));
		if ($prevyear != $eventstartyear) { ?>					      
      		<li class="hidden <?php echo $eventstartyear; ?>"><a href="#filter-<?php echo $eventstartyear; ?>" data-filter=".<?php echo $eventstartyear; ?>" >
      	<?php echo $eventstartyear; ?></a></li>
      <?php }
      $prevyear = $eventstartyear;  
 	endwhile; ?>
</ul>

Thanks!
Toine

#66609

Dear Toine,

The code looks correct. I don't think this is related, but can you try using meta_value_num for the order?

Also, we are about to release Types 1.2.1 with many bugs fixed. I think its a good idea to wait for next release and test again.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#67596

Hi Caridad,

I waited for the 1.2.1 update and tested it just now, but I stil get the same result...
I even updated to WordPress 3.5.1 just to make sure it wasn't wordpress related, but it's really the 1.2+ plugin version that's causing the problem.
Could you please try to replicate my situation/setup and test it yourself?
Thanks!

Cheers, Toine

#68801

Hi there!

I run into the same issue myself. I am running WP v2.5.1 and the Types plugin v1.2.1 which I used to create a custom post type to which I added two custom date fields.
Both these date fields seem to have an issue with some specific dates.

For example if I input the date 2012/11/22 and hit the update button on the admin panel, the value on the admin panel is replaced with 1353542400 which translates to 2400/03/25 on the blog.

I am pretty sure that the fact that part of the wrong date is part of today's date (03/25) is somehow relevant, but I am not sure how.

Also note that this does not happen with all the dates.

#68980

Hi yiannisF,

I just tested it again and yes I can confirm that today's date has something to do with the problem.
On my live website I have an event with date 10 November 2012 which shows fine with the types plugin 1.1.3.4
On my local test website, the same event turns into 25 March, 5600 (1352505600) with the types plugin 2.1.
It only happens with certain dates.

Cheers, Toine

#69419

Dear Toine,

What is the date format you have selected in General -> Settings?

Is it related to dates greater than the 12th?

Regards,
Caridad

#69422

Hi Caridad,

I have the following settings:

Date Format: Custom: j F Y (26 March 2013)
Time Format: 16:28

Cheers, Toine

#69511

I had this same problem. Upgraded to Types 1.2 and now several of my dates (seemingly random) are displaying the unformatted timestamp instead of the formatted date. We've gone through and reset them manually, but I'm concerned this will happen for any of our clients who update to version 1.2+. Thoughts?

#69517

Well I'm glad I'm not the only one with this problem... I thought I was going crazy!
How did you reset them? Because when I try to select the date again in the corresponding post and hit update, the date jumps back to the unformatted timestamp.

The forum ‘Types Community Support’ is closed to new topics and replies.

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