Required datetime field bug?

I have an issue on a fresh, clean plone 5.0.7 installation.

I create a dexterity content type with a required date field, and have an issue. Is this a known bug, or caused by a misconfiguration? I'd happily report this bug somewhere - but I am not sure what module it applies to. Mockup?

To begin with the date widget is empty, and no validation error is marked. Fine.
When selecting a date for the first time, the field is marked with a validation error. (Required input is missing.)

Sometimes the date is not inserted. The date selector stays open.
Selecting the same date again (or another date) in the open date selector inserts the date but does not clear the error marking.
Other times the date is inserted and the selector closed, but the field still marked with a validation error.

Clicking the date selector again, choosing the same (or another) date, clears the error.

Part of my code is pasted here:

from plone.app.z3cform.widget import DateFieldWidget
from plone.autoform import directives as form
from plone.supermodel import model
from plone.namedfile.interfaces import IImageScaleTraversable
from zope import schema

class IAbstract(model.Schema, IImageScaleTraversable):
    """
    """
    item_publication_date = schema.Date(
        title=_(u"Udgivelsesdato"),
        required=True,
    )
    form.widget('item_publication_date', DateFieldWidget)

All the best,
Sune Wøller

Could you try another name than publication date?

@espenmn Thank you for the hint - bad name, and I changed it, but the problem is still present.

I'd like to try to upgrade mockup - but not sure how to do this. Is it enought to upgrade the python module (mockup) or do I also need to build it?

(I could also try to reproduce with plone 5.1b - this will take me a little longer though)

Ok, I have confirmed the bug is solved in plone 5.1b3.

Project is ongoing, will wait a little and see if I can move it to 5.1.

/sune

1 Like

You could take your 5.0.7 site and upgrade just the version of the package in which that fix was made.

Or you could try 5.0.8 which is pending release soon, if you're in a hurry but don't use it yet in production.

I think the fix is in the js in mockup.
I already upgraded plone.app.z3cform and plone.z3cform to the latest - they seem to work fine in 5.0.x. (I see some changes in p.a.z3cform related to the later version of mockup)

If I want to try to upgrade mockup and see what happens - is using a newer version of mockup simply a matter of getting the egg of the later version, or do I need to build the js? I havent yet had time to investigate mockup and the grunt scripts etc. that much...

The result of the build - the js bundles - live in mockup? Would like to try to play around with it, to get updated on the structure etc.

Not in a hurry here - maybe we can even hit the first plone 5.1 release, I will see.

/sune

I don't know much about how mockup works :frowning: so perhaps someone else who does will jump in here.

I found a similar problem in Plone 5.2.
I was trying to use the date filed inside a own dexterity content type.
But after saving there was an error in the format.
Datetime Fail_ANW

If i disable the time field to leave just the date there is a diffrent error from plone,
where it was trying to get a time out of a date.

Just_date

effective = schema.Date(
        title=(u'Datum Test'),
        defaultFactory=date.today,
        required=True
    )
    #directives.widget('effective', DatetimeFieldWidget)

Has someone an idea to solve this ?