Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTC time issue on custom pods date time fields #5382

Open
brigbe opened this issue May 28, 2019 · 7 comments

Comments

Projects
None yet
3 participants
@brigbe
Copy link

commented May 28, 2019

Hi there,
I have an issue with hours display for custom pods date/time fields.

My WP should be in UTC+2 (Belgian hour) but if I do so, when adding a date into one of my pods, it actually remove 3 hours to the time added. Let's I write 10 am, after saving it will show 7 am. The only way to have a correct display of the website is to define it at UTC-1, but then the saving time is incorrect...

In WP general settings, the time stamp under the UTC settings is showing the correct time if I choose UTC+2. Also this issue doesn't seem to affect the time of the post (it's not changing after saving).

Any idea of what can be wrong? Thanks in advance!

Brigitte


EDIT BY JORY:

WordPress Environment

``` Copy and paste your System Details from **Pods Admin > Settings > Debug Information** in WordPress admin here. ```

Pods Package Export (helpful!)

Copy and Paste the JSON Export from **Pods Admin, Migrate: Packages, Export** in WordPress admin here

@issue-label-bot issue-label-bot bot added the Type: Bug label May 28, 2019

@issue-label-bot

This comment has been minimized.

Copy link

commented May 28, 2019

Issue-Label Bot is automatically applying the label Type: Bug to this issue, with a confidence of 0.90. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@JoryHogeveen

This comment has been minimized.

Copy link
Member

commented Jun 5, 2019

Hello @brigbe,

I will need a bit more info on how you configured your field and how you display the date/time data.
Could you share that with me so I can try to reproduce and find a proper solution?

One thing that does instantly come to mind is that I believe BE has winter/summer time as well (Same als NL where I am from).
For NL it's recommended to set WordPress to "Amsterdam" and not "UTC+1" or anything so PHP will automatically change with winter/summer time. You could set it to "Brussels" to apply the same logic.

Thanks!

@brigbe

This comment has been minimized.

Copy link
Author

commented Jun 8, 2019

Hi @JoryHogeveen ,

Sorry I was not available sooner to give you some feedback.

Thanks for your answer. Indeed we have winter and summer time and the issue appears since we are in summer time. I tried to put my Wordpress in Brussels but the problem is still there. The only way to see the correct date is to put it to UTC-1 but I guess it will not be right once we'll be in winter time...

Here are the screenshots of the famous DateTime field.
Screenshot 2019-06-08 at 16 41 22
Screenshot 2019-06-08 at 16 41 16

I have a custom PHP page calling that field and there the hours are showing perfectly well.

I don't know if this is what you need. If you need anything else, just let me know.

Thanks again!

@brigbe

This comment has been minimized.

Copy link
Author

commented Jun 17, 2019

Hi again @JoryHogeveen sorry to be pushy, do you have any idea for this?
Thanks!

@JoryHogeveen

This comment has been minimized.

Copy link
Member

commented Jun 17, 2019

Hi @brigbe,
I'm curious, what is the timezone setting for your server?
Since the date/time/datetime fields are just using the WP date_i18n() function for display it should work/process the same.

Can you also share your Pods package export so I can try to reproduce your issue?

Please include the Pods Package Export as it will be helpful in reproducing your issues.
To access: Pods Admin, Components, Migrate: Packages, Enable.
Then Pods Admin, Migrate: Packages, Export and Copy and Paste the JSON here as code.

I've edited your original report with these options added. You can edit the report again to add the package export and share environment details.

Thanks, Jory

@brigbe

This comment has been minimized.

Copy link
Author

commented Jun 17, 2019

Thanks @JoryHogeveen for the quick feedback.
I'll check the timezone setting of the server with the client as I don't have the hand on this.

Here is the export:

{"meta":{"version":"2.7.12","build":1560778285},"pods":{"1768":{"id":1768,"name":"agenda","label":"Agenda","description":"","type":"post_type","storage":"meta","object":"","alias":"","fields":{"thumbnail":{"id":1770,"name":"thumbnail","label":"Thumbnail","description":"","help":"","class":"","type":"file","weight":0,"pick_object":"custom-simple","pick_val":"","sister_id":"","required":"1","file_format_type":"single","file_uploader":"attachment","file_attachment_tab":"upload","file_edit_title":"1","file_show_edit_link":"0","file_linked":"0","file_limit":"0","file_restrict_filesize":"10MB","file_type":"images","file_field_template":"rows","file_add_button":"Add File","file_modal_title":"Attach a file","file_modal_add_button":"Add File","file_wp_gallery_output":"0","file_wp_gallery_link":"post","file_wp_gallery_columns":"1","file_wp_gallery_random_sort":"0","file_wp_gallery_size":"thumbnail","oembed_enabled_providers_funnyordiecom":"0","oembed_enabled_providers_photobucketcom":"0","oembed_enabled_providers_polldaddycom":"0","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","file_allowed_extensions":""},"agendadate":{"id":1772,"name":"agendadate","label":"Date à l'agenda","description":"","help":"","class":"","type":"datetime","weight":1,"pick_object":"","pick_val":"","sister_id":"","required":"1","datetime_type":"custom","datetime_format":"mdy","datetime_time_type":"24","datetime_time_format":"h_mma","datetime_time_format_24":"hh_mm","datetime_allow_empty":"0","datetime_html5":"0","oembed_enabled_providers_funnyordiecom":"0","oembed_enabled_providers_photobucketcom":"0","oembed_enabled_providers_polldaddycom":"0","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","datetime_format_custom":"D d.m.y","datetime_format_custom_js":"d-m-y","datetime_repeatable":"0","datetime_time_format_custom":"","datetime_time_format_custom_js":""},"practicalinfo":{"id":1774,"name":"practicalinfo","label":"Informations pratiques","description":"","help":"","class":"","type":"wysiwyg","weight":2,"pick_object":"","pick_val":"","sister_id":"","required":"0","wysiwyg_editor":"tinymce","wysiwyg_media_buttons":"1","wysiwyg_oembed":"0","wysiwyg_wptexturize":"1","wysiwyg_convert_chars":"1","wysiwyg_wpautop":"1","wysiwyg_allow_shortcode":"0","oembed_enabled_providers_funnyordiecom":"0","oembed_enabled_providers_photobucketcom":"0","oembed_enabled_providers_polldaddycom":"0","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","wysiwyg_repeatable":"0","wysiwyg_allowed_html_tags":""},"agendatype":{"id":1776,"name":"agendatype","label":"AgendaType","description":"","help":"","class":"","type":"pick","weight":3,"pick_object":"post_type","pick_val":"_agendacat","sister_id":"","required":"1","oembed_enabled_providers_funnyordiecom":"0","oembed_enabled_providers_photobucketcom":"0","oembed_enabled_providers_polldaddycom":"0","pick_format_type":"single","pick_format_single":"dropdown","pick_format_multi":"checkbox","pick_allow_add_new":"1","pick_taggable":"0","pick_show_icon":"1","pick_show_edit_link":"1","pick_show_view_link":"1","pick_limit":"0","pick_user_role":[],"pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","pick_select_text":"","pick_table_id":"","pick_table_index":"","pick_display":"","pick_where":"","pick_orderby":"","pick_groupby":""}},"show_in_menu":"1","label_singular":"Agenda","public":"1","show_ui":"1","supports_title":"1","supports_editor":"1","pll_ajax_backend":"1","publicly_queryable":"1","exclude_from_search":"0","capability_type":"post","capability_type_custom":"exposition","capability_type_extra":"1","has_archive":"0","hierarchical":"0","rewrite":"1","rewrite_with_front":"1","rewrite_feeds":"0","rewrite_pages":"1","query_var":"1","can_export":"1","default_status":"draft","supports_author":"0","supports_thumbnail":"0","supports_excerpt":"0","supports_trackbacks":"0","supports_custom_fields":"0","supports_comments":"0","supports_revisions":"0","supports_page_attributes":"0","supports_post_formats":"0","built_in_taxonomies_category":"0","built_in_taxonomies_language":"1","built_in_taxonomies_link_category":"0","built_in_taxonomies_post_tag":"0","built_in_taxonomies_post_translations":"0","built_in_taxonomies_term_language":"0","built_in_taxonomies_term_translations":"0","show_in_nav_menus":"1","show_in_admin_bar":"1","pfat_enable":"1","pfat_run_outside_loop":"0","pfat_append_single":"replace","pfat_filter_single":"the_content","pfat_append_archive":"append","pfat_filter_archive":"the_content","rest_enable":"0","read_all":"0","write_all":"0","enable_i18n":{"fr_BE":"1","nl_BE":"1"},"pfat_single":"SingleAgenda","built_in_taxonomies_ml-slider":"0","built_in_taxonomies_nt_wmc_folder":"0","built_in_taxonomies_rl_category":"0","built_in_taxonomies_rl_tag":"0"}},"templates":{"SingleAgenda":{"id":1779,"name":"SingleAgenda","code":"<div class=\"row-display grid-1\">\r\n\t<div class=\"col-4x singleIMG\"><img src=\"{@thumbnail._src.thumbnail}\"><\/div>\r\n\t<div class=\"col-8x practicalINFO\">\r\n\t\t<p>{@agendatype.post_title}<\/p>\r\n\t\t<h2 class=\"dates\">{@agendadate}<\/h2>\r\n\t\t<p>{@practicalinfo}<\/p>\r\n\t<\/div>\r\n<\/div>\r\n<div class=\"row-display\">\r\n\t<div class=\"col-2x\"><\/div>\r\n\t<div class=\"col-10x expoFullContent\">{@post_content}<\/div>\r\n<\/div>","type":"template","slug":"singleagenda","options":{"_edit_lock":"1550487116:1","_edit_last":"1","admin_only":"","restrict_capability":"","capability_allowed":"","pod_reference":"a:1:{s:3:\"pod\";s:6:\"agenda\";}"}}}}

@JoryHogeveen

This comment has been minimized.

Copy link
Member

commented Jun 17, 2019

Hello @brigbe
I reproduced your issue and it's probably due to a mismatch in timezones.
For some reason the value is stored correctly (as per user input) but on display it converts it using the WP timezone while thinking it's storage timezone is UTC+0 (which is incorrect).

@sc0ttkclark Could you elaborate on the createFromFormat() method? Why is it converting the value based on the timezone?

Code block:

Commits:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.