Closed beckysoll closed 6 years ago
@beckysoll I just ran into this same issue. Both my Start Date and End Date fields save the values:
start_date: 2018-01-30
end_date: 2018-01-30
It's fixed for next release.
Put https://gist.github.com/jasonvarga/284961bbffa816f788a4850288a864eb in statamic/bundles/Date/DateFieldtype.php
(This is for date fields that are not the date for a dated entry.)
Expected behaviour
For things to work the way they've always worked, if a date field has
allow_blank: true
it should allow for a blank value to be savedActual behaviour
The first time you start a page/entry/whatever, you're shown an "add date" button, as you'd expect. If the date field is left blank. If you leave it blank, edit other fields, and save the page, today's date is saved for that date field. If you've saved and continued, it won't display as such until you refresh the page or leave and come back, if you regular save and open back up, you'll see it. You can delete the date by hitting the x and save... regardless it'll still save the data. if you had a date other than today saved in the field, you've changed your mind and now you want to clear it out, and you do clear it out, it will then continue to save with today's date. You can clear the date from the md file, but once you edit other fields and save, the problem starts all over again.
I first came across this with a date field inside a replicator, but i've tested it right in the root level of the fieldset, makes no difference. I tried making it the only field on the page, same behavior regardless of these tests.
To add complexity, it seems if the date field is inside a replicator set that you had already added to the page's data, before you'd added the date field, and you don't ever open the replicator or interact with the date field, it won't save a date. only after you interact with it, try to clear it out (by default it displays today's date even though none has set) or have it set to an actual date and then try to remove that date), then the problem begins.
Note, i've tried downgrading, and this appears to be an issue with any version 2.8.x, pre 2.8 everything works correctly, as expected.
Steps to reproduce
allow_blank
to true.Server Details
Operating System: Mac os 10.13.2
Web Server: Apache (via mamp pro)
PHP Version: 7.1.8
Statamic Version: 2.8.0 and upwards
Updated from an older Statamic or fresh install: Updated
List of installed addons: Just my Expires On modifier
Logs
no logs