• Resolved berttervoert

    (@berttervoert)


    Hi,
    I’ve created a pod with a date field (which is optional). But when I leave this field empty and save the pod, it shows the current date as the value for this date field in the overview of all entries for the pod in the admin menu.

    Under extra field options I have selected allow empty value (it says lege waarde toestaan? since I have a dutch wp install).
    Under advanced there is an option to give a standard value. Should I enter something there or how can I get it to store nothing when no date is selected?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @berttervoert

    Are you using the latest version of Pods?
    This is a known issue that has been fixed since 2.7.17.
    Related issue: https://github.com/pods-framework/pods/issues/5534

    Cheers, Jory

    Thread Starter berttervoert

    (@berttervoert)

    Hello Jory,

    I’m using the latest version of pods (v.2.7.22). Has the issue returned? What can I do to correct this?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @berttervoert

    What is the default value for this field? Empty?
    Also, what kind of display type are you using?

    Cheers, Jory

    Thread Starter berttervoert

    (@berttervoert)

    Hi jory,

    the default value is indeed empty.
    I havn’t gotten to the display part yet. As I wrote in the initial post, I’m talking bout the overview on the admin page which displays all the entries for this pod. I’ve added a screenshot: the column Lid sinds should be empty, but shows the date for today.

    I’ve checked the database, and the value stored for this date field if left empty is 0000-00-00, which is correct. Why then does it show the current date on the admin overview page?

    https://www.dropbox.com/s/t8txlzmpi72tj77/Screenshot_2020-10-22%20Clubleden%20%E2%80%B9%20De%20Door%28en%29trappers%20%E2%80%94%20WordPress.png?dl=0

    Thread Starter berttervoert

    (@berttervoert)

    Jory,

    I think the problem isn’t coming from pods, but from wordpress itself or the plugin Admin Columns, so I’ll look there for a solution. Thank you for your reactions so far and I’ll mark this as resolved.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @berttervoert

    Thank you for the update. Could you let is know what caused the issue when you find it?
    We also have contact with Admin Columns so if there is anything we can do to speed this up let me know!

    Cheers! Jory

    Thread Starter berttervoert

    (@berttervoert)

    Hi Jory,

    we’re trying to create a hook that lets me alter the value when the raw value is 0000-00-00. This was their explanation why the current date is displayed:

    If you use the custom field column with type set to date it will try to parse a date with strtotime and format it according to the date format that has been applied in the column settings. Apparently, 0000-00-00 is parsed as the current date. While a 0000-00-00 format might not be ideal to have in the database, it is not invalid. I see two options to address this issue.

    I’m still figuring out how to create the hook, since the given info is minimal (for me!), but we’re still corresponding about that.

    Thread Starter berttervoert

    (@berttervoert)

    final update:

    It looks like I messed something up with the settings for date field. I deleted it and recreated it and now it works correct: it shows an empty field if the stored value is 0000-00-00 and the stored date if a date has been entered in the form.

    Thanks again.
    Bert

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @berttervoert

    Ok thanks for the update!

    If you use the custom field column with type set to date it will try to parse a date with strtotime and format it according to the date format that has been applied in the column settings.

    Personally I think this should only be done if the passed value is not empty. At least, that is what Pods does.

    Cheers, Jory

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Empty date field stores current date’ is closed to new replies.