pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

Date Fields with time of 00:00 not loading in editor #6256

Closed HmCody closed 2 years ago

HmCody commented 3 years ago

Description

I have a CPT with 4 date/time fields. All have Allow empty value and Enable HTML5 input field checked. When I edit an item, any of the fields which have a time of 00:00 are not loaded.

This seems like it might be related to the similar problem we had with number field with a value of 0.

Screenshots / screencast

The actual value of Display Date is 01/15/2020 00:00 and Registration Opens is 02/13/2021 00:00. In other items where these fields have times other than 00:00 they are displayed properly. image

Pods version

Version 2.8.3

Other super helpful information

WordPress Environment ``` ` ### wp-core ### version: 5.8.1 site_language: en_US user_language: en_US timezone: America/New_York permalink: /%postname%/ https_status: false multisite: false user_registration: 0 blog_public: 1 default_comment_status: closed environment_type: production user_count: 103 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: C:\Users\hmc\Documents\Visual Studio\WordPress Projects\CRFCRC 2021 wordpress_size: 45.60 MB (47809927 bytes) uploads_path: C:\Users\hmc\Documents\Visual Studio\WordPress Projects\CRFCRC 2021/wp-content/uploads uploads_size: 1.26 GB (1348838155 bytes) themes_path: C:\Users\hmc\Documents\Visual Studio\WordPress Projects\CRFCRC 2021/wp-content/themes themes_size: 23.65 MB (24794495 bytes) plugins_path: C:\Users\hmc\Documents\Visual Studio\WordPress Projects\CRFCRC 2021/wp-content/plugins plugins_size: 104.87 MB (109965870 bytes) database_size: 47.75 MB (50068023 bytes) total_size: 1.47 GB (1581476470 bytes) ### wp-active-theme ### name: Twenty Twenty-One (twentytwentyone) version: 1.4 author: the WordPress team author_website: https://wordpress.org/ parent_theme: none theme_features: core-block-patterns, widgets-block-editor, woocommerce, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, menus, post-thumbnails, title-tag theme_path: fake auto_update: Disabled ### wp-plugins-active (21) ### Admin Columns Pro: version: 5.6.1, author: AdminColumns.com (latest version: 5.6.2), Auto-updates disabled Admin Columns Pro - Pods: version: 1.6.1, author: AdminColumns.com, Auto-updates disabled Admin Menu Editor: version: 1.9.10, author: Janis Elsts (latest version: 1.10), Auto-updates disabled Advanced Access Manager: version: 6.8.0, author: Vasyl Martyniuk , Auto-updates disabled Better Notifications for WP: version: 1.8.6, author: Made with Fuel, Auto-updates disabled CRFCRC Custom Data handling plugin: version: 1.0.0, author: Helenmary Cody, Auto-updates disabled Easy PayPal Button Pro: version: 2.1.11, author: Scott Paterson, Auto-updates disabled Enable Media Replace: version: 3.6.0, author: ShortPixel (latest version: 3.6.1), Auto-updates disabled Enhanced Media Library: version: 2.8.8, author: wpUXsolutions, Auto-updates disabled Gravity Forms: version: 2.5.14, author: Gravity Forms, Auto-updates disabled Loginizer: version: 1.6.7, author: Softaculous, Auto-updates disabled OxyExtras: version: 1.3.8, author: OxyExtras, Auto-updates disabled Oxygen: version: 3.8.1, author: Soflyy, Auto-updates disabled Pods - Custom Content Types and Fields: version: 2.8.3, author: Pods Framework Team, Auto-updates disabled Pods Gravity Forms Add-On: version: 1.4.4, author: Pods Framework Team, Auto-updates disabled Post SMTP: version: 2.0.23, author: Yehuda Hassine, Auto-updates disabled Relevanssi: version: 4.14.3, author: Mikko Saari, Auto-updates disabled Search & Filter Pro: version: 2.5.8, author: Code Amp (latest version: 2.5.10), Auto-updates disabled WP All Export - User Export Add-On Pro: version: 1.0.7, author: Soflyy, Auto-updates disabled WP All Export Pro: version: 1.7.2, author: Soflyy, Auto-updates disabled WPS Hide Login: version: 1.9, author: WPServeur, NicolasKulka, wpformation, Auto-updates disabled ### wp-media ### image_editor: WP_Image_Editor_GD imagick_module_version: Not available imagemagick_version: Not available imagick_version: Not available file_uploads: File uploads is turned off post_max_size: 8M upload_max_filesize: 1000M max_effective_size: 8 MB max_file_uploads: 20 gd_version: bundled (2.1.0 compatible) gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM ghostscript_version: not available ### wp-server ### server_architecture: Windows NT 10.0 i586 httpd_software: PHP 7.4.13 Development Server php_version: 7.4.13 php_sapi: cli-server max_input_variables: 1000 time_limit: 300 memory_limit: 128M admin_memory_limit: 256M max_input_time: 60 upload_max_filesize: 1000M php_post_max_size: 8M curl_version: 7.70.0 OpenSSL/1.1.1h suhosin: false imagick_availability: false pretty_permalinks: false htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 8.0.22 client_version: mysqlnd 7.4.13 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: C:\Users\hmc\Documents\Visual Studio\WordPress Projects\CRFCRC 2021/wp-content WP_PLUGIN_DIR: C:\Users\hmc\Documents\Visual Studio\WordPress Projects\CRFCRC 2021/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8mb4 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable ### pods ### pods-server-software: PHP 7.4.13 Development Server pods-user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 pods-session-save-path: C:\Windows\temp pods-session-save-path-exists: Yes pods-session-save-path-writable: Yes pods-session-max-lifetime: 1440 pods-opcode-cache-apc: No pods-opcode-cache-memcached: No pods-opcode-cache-opcache: No pods-opcode-cache-redis: No pods-object-cache-apc: No pods-object-cache-apcu: No pods-object-cache-memcache: No pods-object-cache-memcached: No pods-object-cache-redis: No pods-memory-current-usage: 75.111M pods-memory-current-usage-real: 20.000M pods-network-wide: No pods-install-location: C:\Users\hmc\Documents\Visual Studio\WordPress Projects\CRFCRC 2021\wp-content\plugins\pods/ pods-developer: No pods-tableless-mode: No pods-relationship-table-enabled: Yes pods-light-mode: No pods-strict: No pods-allow-deprecated: Yes pods-api-cache: Yes pods-shortcode-allow-evaluate-tags: No pods-sessions: Disable sessions pods-can-use-sessions: Yes ` ```
Pods Package Export ```json Copy and paste your Pods Admin > Migrate: Packages > Export and paste the code over this line. ```
HmCody commented 3 years ago

Some additional info.

I have a copy of the same site running with Pods Version 2.8.0. On that version, a date/time of 03/14/2021 00:00 is being displayed in the editor as 03/14/2021 12:00. Trying to change any other date/time field to a value of mm/dd/yy 00:00 results in the display showing 12:00 as well.

sc0ttkclark commented 3 years ago

Fixed via 20f39438be0f648026016b09e0d51e82555a5515

HmCody commented 3 years ago

I just loaded 2.8.4 and this is still not working.

When I open a Field Event with known date values, the ones with a time of 00:00 are not loaded. Also, my field is set to use a 24 hour Time Format with no seconds, but the editor is displaying a 12 hour clock. If I enter "00" for the hour, it is immediately changed to "12" then if I type "a" in the am/pm spot, the whole field blanks out again. I also can't select midnight using the date/time picker.

Let me know if there is anything I can do to help sort this out.

sc0ttkclark commented 3 years ago

I'll take a look again, my initial testing showed this working so I'll see if something changed here.

HmCody commented 3 years ago

I just tried changing the settings for one of the date fields to disable HTML5 input and now it lets me enter a 00:00 time.

sc0ttkclark commented 3 years ago

The HTML5 input will almost always default to the browser locale settings, so it will then do it's own 12 vs 24 hour handling. If you are presented with the 12 hour (AM/PM) input for the HTML5 input, then entering "00:00" is not a valid time for that HTML5 input.

Does this clear things up for you further?

HmCody commented 3 years ago

I don't think so, but maybe I wasn't clear about what is happening.

Not only can I not change the time to midnight with html5, a field with midnight already entered won't load if using html5. I just get the placeholders, even though there is a valid entry.

Let me see if I can show you. This is how the edit screen for one entry looks with 24 hour time format and html5 disabled on all of the date fields. I have set all but Event Date to midnight. image

I then changed the fields back to using html5, using a variety of time formats. Github won't let me upload the video, so I am sending it to you on Slack, which is slow, though more accommodating.

You can see in the video that the fields with a time of midnight now do not even load and how they react to input. For Display Date I tried entering 00:00, but it was changed to 12 when I left the hour placeholder. For Registration Opens, I tried entering 12:00a.

I suppose I could just not use html5 for this, but I really prefer how it displays the entries.

sc0ttkclark commented 3 years ago

Ok sounds like for HTML5 fields we should avoid reformatting and validating in DFV and let the browser do that. We'll have another look at this.

sc0ttkclark commented 2 years ago

There's a fix for this in the release/2.8.9 branch now @HmCody if you'd like to confirm.

https://github.com/pods-framework/pods/archive/refs/heads/release/2.8.9.zip

HmCody commented 2 years ago

You snuck that in! I looked a couple of hours ago and there was no change.

I will take a look and let you know.

Thanks!

HmCody commented 2 years ago

That seems to have fixed the problem. Do you have a feeling for when it will be released?

One other thing, that maybe I should open another ticket for. Loading/saving a pod, and this applies to all of my pods, seems to take a lot longer than it used to. For instance, on my production site which is still running Pods 2.7.31, loading a Field Event is almost instantaneous. On my local machine it takes almost 8 secs. It could be the difference in environments, but I don't remember it taking that long on local before this.

sc0ttkclark commented 2 years ago

2.8.9 will go out today if my schedule allows, I'll take a look at the time difference you're talking about -- can you open a new ticket about that with more details about how / where to reproduce?

HmCody commented 2 years ago

I am in the midst of another project which is time sensitive, so I probably won't get to the bug report for a week or two.

Thanks for getting 2.8.9 (almost) out the door!