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 265 forks source link

Cannot save time as 12:00am when using date picker with field type set to time #3488

Closed Pezzab closed 6 years ago

Pezzab commented 8 years ago

As it says on the tin. This is true of the latest update to Pods and the previous version. If I try to set the time to 12:00am and update the page the form field goes blank.

This works the same if the time is set to 12 or 24 hour format.

Having noticed this on a test site I tried to see if I could repeat it on a live site I use this field on. Here the form not only didn't stay at 12:00am after updating it pulled in another time seemingly at random - the saved time changes each time I try and re save as 12:00am.

The test site as no other plugins installed. The live site has quite a few.

So two variations: field returns to blank each time I save as 12:00am or instead it returns an apparently random time.

Pezzab commented 8 years ago

Just an update to this - I forgot to say that despite the field refusing to display "12:00am" after saving that the time is set to "00:00:00" anyway.

So I guess that strictly speaking the time is saved as 12:00am it's just that the field remains blank - principally a UI issue (ie confusing for someone using that field if the time they are saving does not show up).

robrecord commented 7 years ago

Not sure if this is related, but I cannot set an empty value for time - it always shows as 12am - and I can't use template tags to filter it out because [if fime_field] always returns true.

robrecord commented 7 years ago

To fix, unless mistaken I believe you need to add '00:00:00' to lines 153, 230, 256, 336 in pods/classes/fields/time.php:

!in_array( $value, array( '0000-00-00', '0000-00-00 00:00:00', '00:00:00' ) )

although this doesn't help with the [if time_field] template tags - they always return true.

pglewis commented 6 years ago

Closing as a duplicate of #4937, should be resolved in #4959