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

Custom date format error and inconsistancy #6213

Closed richhansen closed 3 years ago

richhansen commented 3 years ago

Description

In a custom Post Type, we've defined a Date field (without Time) and gave it a custom input format, "dd/mm/yy." This European format is not accepted when we try to save the Post entry. The output display format, "M yy", displays correctly.

Screenshots / screencast

Desired custom date input format: Capture0

Input date display: Capture2

Error on saving entry: Capture2a

Another date input format: Capture3

Display in Post entry's record: Capture4

Another date input format used as workaround: Capture5

Display in Post entry's record: Capture6

Possible workaround

We set the custom input format to "yy-mm-dd", which is displayed as "yyyy-mm-dd", and we can save our Post with the correct date.

Pods version

This error popped up with the update to version 2.8.0. We have updated to version 2.8.1.

Other super helpful information

We are running Wordpress version 5.7.3 We delete the Pods cache and Wordpress cache after each update.

WordPress Environment ``` ` ### wp-core ### version: 5.7.3 site_language: en_GB user_language: en_GB timezone: Europe/Paris permalink: /%category%/%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 1 default_comment_status: closed environment_type: production user_count: 4 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /var/www/html/wordpress wordpress_size: 83.49 MB (87541701 bytes) uploads_path: /var/www/html/wordpress/wp-content/uploads uploads_size: 4.73 GB (5083276994 bytes) themes_path: /var/www/html/wordpress/wp-content/themes themes_size: 3.73 MB (3911556 bytes) plugins_path: /var/www/html/wordpress/wp-content/plugins plugins_size: 89.72 MB (94080500 bytes) database_size: 233.25 MB (244581169 bytes) total_size: 5.13 GB (5513391920 bytes) ### wp-dropins (1) ### advanced-cache.php: true ### wp-active-theme ### name: unepfi (fi) version: 1.0.0 author: Richard Hansen author_website: http://www.unepfi.org/ parent_theme: none theme_features: core-block-patterns, post-thumbnails, automatic-feed-links, title-tag, menus, html5, custom-background, custom-header, infinite-scroll, jetpack-responsive-videos, widgets, editor-style theme_path: /var/www/html/wordpress/wp-content/themes/fi auto_update: Disabled ### wp-themes-inactive (1) ### Twenty Twenty-One: version: 1.4, author: the WordPress team, Auto-updates disabled ### wp-plugins-active (37) ### Add Categories to Pages.: version: 1.2, author: a.ankit, Auto-updates disabled Advanced Custom Fields: version: 5.10.2, author: Delicious Brains, Auto-updates enabled Aurora Heatmap: version: 1.5.3, author: R3098, Auto-updates disabled BE Subpages Widget: version: 1.7, author: Bill Erickson, Auto-updates enabled Better Click To Tweet: version: 5.10.1, author: Ben Meredith, Auto-updates disabled Civil Footnotes: version: 2.1, author: K. Adam White, Austin Sweeney, Auto-updates enabled Classic Editor: version: 1.6.2, author: WordPress Contributors, Auto-updates enabled Content Update Scheduler: version: 1.0, author: Infinitnet, Auto-updates disabled Content Views: version: 2.4.0.2, author: Content Views, Auto-updates enabled Content Views Pro: version: 5.8.6.1, author: Content Views (latest version: 5.8.7.1), Auto-updates disabled Curator.io: version: 1.6, author: Thomas Garrood, Auto-updates enabled Custom Sidebars: version: 3.32, author: WebFactory Ltd, Auto-updates enabled Custom Twitter Feeds: version: 1.8.3, author: Smash Balloon, Auto-updates enabled Disable REST API: version: 1.7, author: Dave McHale, Auto-updates enabled Display Posts: version: 3.0.2, author: Bill Erickson, Auto-updates enabled Enable Media Replace: version: 3.6.0, author: ShortPixel, Auto-updates enabled Enhanced Media Library: version: 2.8.8, author: wpUXsolutions, Auto-updates enabled Forget About Shortcode Buttons: version: 2.1.2, author: Designs & Code, Auto-updates disabled Google Analytics for WordPress by MonsterInsights: version: 8.1.0, author: MonsterInsights, Auto-updates enabled Page Links To: version: 3.3.5, author: Mark Jaquith, Auto-updates enabled Pods - Custom Content Types and Fields: version: 2.8.1, author: Pods Framework Team, Auto-updates disabled Redirection: version: 5.1.3, author: John Godley, Auto-updates enabled Responsive Menu: version: 4.1.4, author: ExpressTech, Auto-updates enabled Show-Hide/Collapse-Expand: version: 1.2.5, author: Bunte Giraffe, Auto-updates enabled Smart Slider 3 Pro: version: 3.5.1.1, author: Nextend, Auto-updates enabled Social Media Feather: version: 2.0.3, author: socialmediafeather, Auto-updates enabled TablePress: version: 1.14, author: Tobias Bäthge, Auto-updates enabled Tabs Responsive: version: 2.2.3, author: wpshopmart, Auto-updates enabled Title Remover: version: 1.2.1, author: WPGurus, Auto-updates enabled UNEPFI Download: version: 1, author: Richard Hansen, Auto-updates disabled UNEPFI Forms: version: 1, author: Richard Hansen, Auto-updates disabled UNEPFI List Members: version: 3, author: Richard Hansen, Auto-updates disabled UNEPFI List Posts: version: 1, author: Richard Hansen, Auto-updates disabled Video Gallery by Huzzaz: version: 10.3, author: Huzzaz, Auto-updates disabled Waiting: version: 0.5.3, author: Plugin Builders, Auto-updates enabled WPForms Lite: version: 1.7.0, author: WPForms, Auto-updates enabled WP Super Cache: version: 1.7.4, author: Automattic, Auto-updates enabled ### wp-plugins-inactive (1) ### Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue: version: 3.1.22, author: Sendinblue, Auto-updates enabled ### wp-media ### image_editor: WP_Image_Editor_GD imagick_module_version: Not available imagemagick_version: Not available file_uploads: File uploads is turned off post_max_size: 200M upload_max_filesize: 200M max_effective_size: 200 MB max_file_uploads: 20 gd_version: 2.3.2 ghostscript_version: not available ### wp-server ### server_architecture: Linux 3.10.0-1160.31.1.el7.x86_64 x86_64 httpd_software: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips php_version: 7.4.23 64bit php_sapi: fpm-fcgi max_input_variables: 10000 time_limit: 180 memory_limit: 512M max_input_time: 60 upload_max_filesize: 200M php_post_max_size: 200M curl_version: 7.29.0 NSS/3.53.1 suhosin: false imagick_availability: false pretty_permalinks: true htaccess_extra_rules: false ### wp-database ### extension: mysqli server_version: 10.4.21-MariaDB-log client_version: mysqlnd 7.4.23 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /var/www/html/wordpress/wp-content WP_PLUGIN_DIR: /var/www/html/wordpress/wp-content/plugins WP_MEMORY_LIMIT: 256M WP_MAX_MEMORY_LIMIT: 512M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: true CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable ### wpforms ### version: 1.7.0 lite: May 22, 2017 @ 5:09pm upload_dir: Writable db_tables: wp_wpforms_tasks_meta total_forms: 8 total_submissions: 1869 ### pods ### pods-server-software: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips pods-user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0 pods-session-save-path: /var/opt/remi/php74/lib/php/session 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: Yes pods-opcode-cache-redis: No pods-object-cache-apc: No pods-object-cache-apcu: No pods-object-cache-memcache: No pods-object-cache-memcached: Yes pods-object-cache-redis: No pods-memory-current-usage: 21.917M pods-memory-current-usage-real: 20.000M pods-network-wide: No pods-install-location: /var/www/html/wordpress/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 **"testdate" is the field in error** ```json { "meta": { "version": "2.8.1", "build": 1634827321 }, "pods": [ { "name": "member", "id": 521, "label": "Members", "description": "", "label_singular": "Member", "public": "1", "show_ui": "1", "supports_title": "1", "supports_editor": "1", "type": "post_type", "storage": "meta", "publicly_queryable": "1", "exclude_from_search": "0", "capability_type": "post", "capability_type_custom": "member", "capability_type_extra": "1", "has_archive": "1", "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_link_category": "0", "built_in_taxonomies_post_tag": "0", "show_in_menu": "1", "show_in_nav_menus": "1", "show_in_admin_bar": "1", "built_in_taxonomies_region": "1", "pfat_enable": "1", "pfat_single": "MemberTemplate", "pfat_append_single": "replace", "pfat_filter_single": "the_content", "pfat_append_archive": "replace", "pfat_filter_archive": "custom", "built_in_taxonomies_country": "1", "built_in_taxonomies_industry": "1", "pfat_archive": "MemberTable", "pfat_run_outside_loop": "1", "rest_enable": "0", "read_all": "0", "write_all": "0", "menu_position": "0", "pfat_filter_archive_custom": "the_content", "built_in_taxonomies_initiative": "1", "built_in_taxonomies_media_category": "0", "_migrated_28": "1", "groups": [ { "name": "more_fields", "id": 47795, "label": "More Fields", "description": "", "weight": 0, "storage_type": "post_type", "fields": [ { "name": "membership", "id": 34885, "label": "Membership", "description": "Use only for special memberships or small initiatives", "weight": 0, "type": "text", "required": "0", "text_allow_shortcode": "0", "text_allow_html": "0", "text_allowed_html_tags": "strong em a ul ol li b i", "text_max_length": "255", "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", "text_repeatable": "0" }, { "name": "unepfi_member", "id": 38604, "label": "UNEPFI member", "description": "If the organisation is NOT a UNEPFI member, then un-check this box.", "weight": 1, "type": "boolean", "required": "0", "pick_post_status": [ "publish" ], "boolean_format_type": "checkbox", "boolean_yes_label": "Yes", "boolean_no_label": "No", "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", "default_value": "1" }, { "name": "date_joined", "id": 523, "label": "Date joined", "description": "Date joined UNEPFI", "weight": 2, "type": "date", "required": "0", "date_format": "dmy", "date_allow_empty": "1", "date_html5": "0", "pick_post_status": [ "publish" ], "admin_only": "0", "restrict_role": "0", "restrict_capability": "0", "hidden": "0", "read_only": "0", "roles_allowed": [ "administrator" ], "unique": "0", "date_repeatable": "0", "date_type": "format", "rest_read": "0", "rest_write": "0", "rest_pick_response": "array", "rest_pick_depth": "2" }, { "name": "website", "id": 524, "label": "Website", "description": "Company website", "weight": 3, "type": "website", "required": "0", "website_format": "normal", "website_clickable": "0", "website_new_window": "0", "website_max_length": "255", "website_html5": "0", "pick_post_status": [ "publish" ], "admin_only": "0", "restrict_role": "0", "restrict_capability": "0", "hidden": "0", "read_only": "0", "roles_allowed": [ "administrator" ], "unique": "0", "website_repeatable": "0", "website_allow_port": "0" }, { "name": "logo", "id": 526, "label": "Logo", "description": "Company logo", "weight": 4, "type": "file", "required": "0", "file_format_type": "single", "file_uploader": "attachment", "file_attachment_tab": "upload", "file_edit_title": "1", "file_linked": "0", "file_limit": "0", "file_restrict_filesize": "10MB", "file_type": "images", "file_add_button": "Add File", "file_modal_title": "Attach a file", "file_modal_add_button": "Add File", "pick_post_status": [ "publish" ], "admin_only": "0", "restrict_role": "0", "restrict_capability": "0", "hidden": "0", "read_only": "0", "roles_allowed": [ "administrator" ], "unique": "0", "file_show_edit_link": "0", "file_field_template": "rows", "file_upload_dir": "wp" }, { "name": "external_logo", "id": 2898, "label": "External Logo", "description": "Company logos outside of Wordpress Media folder. Used only for members before 2016.", "weight": 5, "type": "text", "required": "0", "text_allow_shortcode": "0", "text_allow_html": "0", "text_allowed_html_tags": "strong em a ul ol li b i", "text_max_length": "255", "pick_post_status": [ "publish" ], "admin_only": "0", "restrict_role": "0", "restrict_capability": "0", "hidden": "0", "read_only": "0", "roles_allowed": [ "administrator" ], "unique": "0", "text_repeatable": "0", "rest_read": "0", "rest_write": "0", "rest_pick_response": "array", "rest_pick_depth": "2" }, { "name": "subsidiary_of", "id": 14328, "label": "Subsidiary of", "description": "Parent organisation if subsidiary", "weight": 6, "type": "text", "required": "0", "text_allow_shortcode": "0", "text_allow_html": "0", "text_allowed_html_tags": "strong em a ul ol li b i", "text_max_length": "255", "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", "text_repeatable": "0" }, { "name": "date_signed", "id": 38454, "label": "Date signed PRB or PSI", "description": "Date became PRB or PSI signatory", "weight": 7, "type": "date", "required": "0", "date_type": "custom", "date_format": "dmy", "date_allow_empty": "1", "date_html5": "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", "date_repeatable": "0", "date_format_custom": "M y", "date_format_custom_js": "yy-mm-dd", "sister_id": "-- Select One --" }, { "name": "date_signed_nzba", "id": 47049, "label": "Date Signed NZBA", "description": "Date became NZBA signatory", "weight": 8, "type": "date", "required": "0", "date_type": "custom", "date_format_custom": "M y", "date_format_custom_js": "yy-mm-dd", "date_format": "mdy", "date_allow_empty": "1", "date_html5": "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": "1", "sister_id": "-- Select One --" }, { "name": "report_list", "id": 41572, "label": "PRB or PSI Report list", "description": "List of PRB or PSI report dates<\/b> with links<\/b> to online Commitment\/Disclosure reports.
Use HTML code: <a href=\"reportURL\">Month Year<\/a>", "weight": 9, "type": "wysiwyg", "required": "0", "wysiwyg_editor": "tinymce", "wysiwyg_media_buttons": "0", "wysiwyg_oembed": "0", "wysiwyg_wptexturize": "1", "wysiwyg_convert_chars": "1", "wysiwyg_wpautop": "0", "wysiwyg_allow_shortcode": "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_editor_height": "100" }, { "name": "founding_signatory", "id": 38464, "label": "Founding signatory", "description": "", "weight": 10, "type": "boolean", "required": "0", "pick_post_status": [ "publish" ], "boolean_format_type": "checkbox", "boolean_yes_label": "Yes", "boolean_no_label": "No", "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" }, { "name": "activity", "id": 18290, "label": "Activity", "description": "Allows grouping of members in activities", "weight": 11, "type": "text", "required": "0", "text_allow_shortcode": "0", "text_allow_html": "0", "text_allowed_html_tags": "strong em a ul ol li b i", "text_max_length": "255", "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", "text_repeatable": "0" }, { "name": "activity_content", "id": 18291, "label": "Activity content", "description": "Description of this member's role in the activity", "weight": 12, "type": "code", "required": "0", "code_allow_shortcode": "0", "code_max_length": "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", "code_repeatable": "0" }, { "name": "activity_media", "id": 18315, "label": "Activity media", "description": "Embed Video Media for activity", "weight": 13, "type": "oembed", "required": "0", "oembed_width": "0", "oembed_height": "0", "oembed_show_preview": "0", "oembed_restrict_providers": "0", "oembed_enabled_providers_amazoncn": "0", "oembed_enabled_providers_amazoncouk": "0", "oembed_enabled_providers_amazoncom": "0", "oembed_enabled_providers_amazoncomau": "0", "oembed_enabled_providers_amazonin": "0", "oembed_enabled_providers_animotocom": "0", "oembed_enabled_providers_cloudupcom": "0", "oembed_enabled_providers_collegehumorcom": "0", "oembed_enabled_providers_dailymotioncom": "0", "oembed_enabled_providers_facebookcom": "0", "oembed_enabled_providers_flickrcom": "0", "oembed_enabled_providers_funnyordiecom": "0", "oembed_enabled_providers_hulucom": "0", "oembed_enabled_providers_imgurcom": "0", "oembed_enabled_providers_instagramcom": "0", "oembed_enabled_providers_issuucom": "0", "oembed_enabled_providers_kickstartercom": "0", "oembed_enabled_providers_meetupcom": "0", "oembed_enabled_providers_mixcloudcom": "0", "oembed_enabled_providers_photobucketcom": "0", "oembed_enabled_providers_polldaddycom": "0", "oembed_enabled_providers_redditcom": "0", "oembed_enabled_providers_reverbnationcom": "0", "oembed_enabled_providers_screencastcom": "0", "oembed_enabled_providers_scribdcom": "0", "oembed_enabled_providers_slidesharenet": "0", "oembed_enabled_providers_smugmugcom": "0", "oembed_enabled_providers_someecardscom": "0", "oembed_enabled_providers_soundcloudcom": "0", "oembed_enabled_providers_speakerdeckcom": "0", "oembed_enabled_providers_spotifycom": "0", "oembed_enabled_providers_tedcom": "0", "oembed_enabled_providers_tumblrcom": "0", "oembed_enabled_providers_twittercom": "0", "oembed_enabled_providers_vimeocom": "0", "oembed_enabled_providers_wordpresscom": "0", "oembed_enabled_providers_wordpresstv": "0", "oembed_enabled_providers_youtubecom": "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", "oembed_repeatable": "0" }, { "name": "testdate", "id": 47804, "label": "Testdate", "description": "", "weight": 14, "type": "date", "sister_id": "-- Select One --", "required": "0", "date_type": "custom", "date_format": "mdy", "date_allow_empty": "1", "date_html5": "0", "roles_allowed": "administrator", "rest_pick_response": "array", "rest_pick_depth": "1", "date_format_custom": "M yy", "date_format_custom_js": "dd\/mm\/yy" } ] } ] } ] } ```
arius28 commented 3 years ago

Not to hijack but I think I have the same issue with the same date format dd/mm/yy but taking it from the predefined options in the dropdown (Screen A). I am on Wordpress 5.8.1 and pods 2.8.1. In my pod when clicking on the field instead of the calendar/time component I only get time (Screen B).

Screen A Clipboard02

Screen B Clipboard01

jamesgol commented 3 years ago

I was able to reproduce this issue. It looks like 2.7 might not have been properly validating the fields.

JoryHogeveen commented 3 years ago

The new date/time picker is different from the jQuery one in 2.7 and lower. There might be some formatting differences? @zrothauser @sc0ttkclark

zrothauser commented 3 years ago

@JoryHogeveen The new date/time field uses a very different format, and there's a whole set of functions for parsing and converting the old formats: https://github.com/pods-framework/pods/blob/main/ui/js/dfv/src/helpers/dateFormats.js

and tests for these: https://github.com/pods-framework/pods/blob/main/ui/js/dfv/src/helpers/test/dateFormats.js

jamesgol commented 3 years ago

I don't think anything about this bug has anything to do with DFV, it's all on the php side. The PodsField_DateTime::validate() function is only trying to validate against the PodsField_DateTime::$storage_format and not what is configured in the Pod.

If I have some time this afternoon I'll see if I can come up with some tests and a fix.

JoryHogeveen commented 3 years ago

@jamesgol Correct, that is because all dates are only stored in MYSQL format and jQuery previously only send this format for validation. Other formats are UI only

JoryHogeveen commented 3 years ago

Now that I think of it, that must be the issue. The DFV field sends the formatted value, not the storage format.

jamesgol commented 3 years ago

Oh, I was thinking about it the wrong way. Then it would be a DFV issue, the php portion should only be receiving it in the storage format.

sc0ttkclark commented 3 years ago

I'll dig further into this tomorrow but I'm close on it

sc0ttkclark commented 3 years ago

Figured this out, when using custom format, the display and input formats may diverge and when that happens -- the format wasn't matching what it expected so it would cause it to become invalid in that check.

Fixed via 0663c6b8ce1fd794dd413b36a090a1a1bfeec58e in which it now checks for format of JS then PHP format to see if it matches either.

JoryHogeveen commented 3 years ago

@sc0ttkclark I still think it would be better if React would send the HTML5/MySQL format to the server and not custom formats. We did the same think for jQuery.

Edit: The reason for this is that it's very tricky to support ALL available formats, especially custom ones where users could add tekst within a date format.

sc0ttkclark commented 3 years ago

Previously, we used altField with jQuery UI datepicker and it would automatically use/store the MySQL value. It did submit the date/time in MySQL format on form submit. New DFV code does not have this functionality though it's possible we could look into a similar implementation with time.

For now, the PHP solution we've put into place takes advantage of the same logic that jQuery was doing client-side and does that server-side which may be better in general when it comes to dealing with inputs directly from PHP saves via Pods::save() etc.

JoryHogeveen commented 3 years ago

Ok, I think we would greatly benefit of a similar implementation as I can recall a lot of issues and bugs with parsing dates through PHP. This is the whole reason I added the altField as a solution: https://github.com/pods-framework/pods/pull/5451