Skip Navigation

[Resuelto] Time values in date / time fields being incorrectly offset when post is saved

This support ticket is created hace 2 años, 11 meses. 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 6 respuestas, has 2 mensajes.

Last updated by Beda hace 2 años, 11 meses.

Assigned support staff: Beda.

Autor
Mensajes
#1510199

I am trying to: use date / time field on a custom post type of 'Events'.

Link to a page where the issue can be seen:
hidden link

I expected to see:
The time I set in the dropdowns being saved when I publish or update the post.

Instead, I got: the hour value I enter is decremented by 1 hour. For example, if I enter 18, it changes to 17 after the post is updated.

I have tried changing the WordPress time zone, setting it to London and to GMT. Neither makes a difference. The server time is also set to GMT.

The workaround is to add 1 hour to the time I enter, but this is annoying and not really acceptable. Why is the data I enter being altered?

#1510211

I receive an "ERROR: The username or password you entered is incorrect. Lost your password?" on the login page.

The Toolset Date Field should display - in a working case - the exact value you saved in a timestamp, no matter the timezone you use in the WordPress settings.

When you add 12:41 in a post, and display that value with [types field='date' style='text' format='F j, Y g:i a'][/types] or similar, you will see on the front end the date and 12:41 as time.

If this is not how it works on your site something must alter the value saved or displayed.
I'd start with making sure the ShortCode to display the time is functional, then if other plugins or the theme are interfering (by disabling them, on a testing site, for example).

If the issues persist - maybe you could send me a copy of the site, so I can look at it on another (local) server to ensure it is not the server.

I enable a private reply for this purpose.

#1510291
#1510361
Bildschirmfoto 2020-02-15 um 18.51.24.png

You're using a GTM timezone, I do not have that option in the WordPress general settings.
I have UTC, and any other timezone, but not GMT.

How've you added that?

However, I can't see an issue.
I added a test post hidden link with 01:01 and that is what I see in the editor now.
This, after saving and reloading.

If you experience issues as you described, in this case, I would go with disabling other plugins and use another theme, on a staging site, to see if another software somehow alters the date.

#1510373

You can't see this?

hidden link

Like I said, I also set the timezone to London, and it didn't help.

#1510387

I can't see that, on my local install, it does not seem a default WordPress setting.
And I can't see the issue on the single post as I show in my previous reply, on your very install
Can you see the wrong time on the post I created?

I suggest following up with the additional steps mentioned here if the issue persists, but as said, I wasn't able to see it on your site.
https://toolset.com/forums/topic/time-values-in-date-time-fields-being-incorrectly-offset-when-post-is-saved/#post-1510361

#1510449

Here's how to reproduce:
1. Create a new event post. Set the date to 1st June 2020 (i.e. AFTER daylight saving time comes in to effect in the UK)
2. Set the time to 06:00
3. Update the post
4. Time stamp changes to 05:00

Toolset is changing the entered local time because it's compensating for daylight saving time, which will be in force when the event takes place. But I don't want it to do that. I put it to you that nobody would expect their timestamps to be corrected in this way.

(BTW please set any test posts you create to Private)

#1514221

Toolset uses Timestamps, those do not consider any Summer or Wintertime (daylight savings)
Not all countries do follow it in any case, sometimes even countries do follow it one year but not next, and even worse, some countries have parts they follow, others not.

I can confirm on your install, dates in June are losing an hour.
However, this does (as mentioned previously) not happen on a fresh WordPress site with Toolset

I noticed on your site even the Date is actually losing an entire day when inserting (so you insert 2nd June, it states 1st June later)
That's also not happening locally.

I am meanwhile almost sure, this is a compatibility issue with another software.
Please try, on a staging site, to disable other plugins, code and theme and test again.

This issue does not happen on any other install I tested.