pods icon indicating copy to clipboard operation
pods copied to clipboard

DateTime: Fix empty dates

Open JoryHogeveen opened this issue 1 year ago • 1 comments

Description

This PR makes sure React allows empty dates if the user allowed it in the field settings.

Related GitHub issue(s)

Fixes #6912

Changelog text for these changes

PR checklist

JoryHogeveen avatar Sep 23 '22 08:09 JoryHogeveen

@sc0ttkclark Please review this PR thoroughly since it changes the way we store empty dates. Currently we always store a date, even if empty (0000-00-00 etc). With this PR this changes. We still allow storage of such empty dates but by default it will simply store an empty string. This will improve compatibility with third party tools for empty checks while AFAIK it will also be backwards compatible since we check for an empty string as well in PodsField_DateTime::is_empty()

JoryHogeveen avatar Sep 23 '22 09:09 JoryHogeveen

  • Added use of Pods\Whatsit\Pod class.
  • Changed the way empty values are handled for datetime fields in table-based pods to match how they're handled in meta-based pods (empty string instead of 0000-00-00 00:00:00).
  • Fixed a bug where an invalid date would be saved as '0000' when using HTML5 input type="datetime". This was caused by not passing allowEmpty flag to dateTimeValidator().

what-the-diff[bot] avatar Oct 31 '22 04:10 what-the-diff[bot]