Skip Navigation

[Resolved] A Custom Date field is not being translated properly in a layout and view

This thread is resolved. Here is a description of the problem and solution.

Problem:
A Custom Date field is not being translated properly in a layout and view
Solution:
You should use date field with style='text' attribute.

For example:

[types field='stud-registration-date' style='text' format='l jS F Y'][/types]

Relevant Documentation:

This support ticket is created 6 years, 6 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 5 replies, has 2 voices.

Last updated by Minesh 6 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#954753

I am trying to:
Display a custom date field in a layout and a view. The values were properly formatted on screen until recently.

An example of the code:
[su_column size="1/3" center="no" class=""]TX Date: [types field="transmission-date" format='jS F Y'][/types].[/su_column]

The format value had been successfully translating dates into the format (for example): 24th July 2018. I've not changed anything that would affect this yet it has suddenly stopped working and the date is appearing on my pages as a series of numbers.

Link to a page where the issue can be seen:

Unfortunately, the site is not live just yet. It's still in test mode.

I expected to see:

A date value that I expected to see is:

Sunday 17th February 1974

Instead, I got:

The above date is currently displaying as:

130291200

...in spite of the above format clause.

#955385

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - I just checked with my local test install and I output the date as given under:

I've added the following shortcode to the post body and the date field value is set to 17th February 1974.

Date == [types field='stud-registration-date' style='text' format='l jS F Y'][/types]

Now, above shortcode renders the output as given under:

Date === Sunday 17th February 1974

Is it not working for you or am I missing anything here?

#955425

So, I've pinpointed the issue. I noticed in your example that you included:

style='text'

I have now included this and the date is translating properly again. Curiously though, the dates had been outputting fine for months without the style='text' value.

#955434

Minesh
Supporter

Languages: English (English )

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

Well - you can use the shortcode I shared as it will not going to break. However, I've reported this issue to our Devs and its been fixed in near future release.

#955752

Thaks very much for the help!

#957139

Minesh
Supporter

Languages: English (English )

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

Quick update to let you know a patch has been created. Feel free to install the patch here, or wait until the next plugin release. => https://toolset.com/errata/types-fields-are-not-displayed-properly-using-types_render_field/