Default value in input-type Date

Enonic version: 7.2.2
OS: MacOS 10.15

in a project we are working on we just encountered an issue in the create() content API. We tried to write in a content-type a Date input-type with a string value like this: ‘2020-06-02’. The Date input-type had occurrences minimum=“1” maximum=“1”, and had a default as (2000-01-01) and this default value overwrote all the time the value we sent in. Only by removing the default value we managed to write the data we sent in. Is it an Issue or did we do something wrong by sending the date as string? It works fine without default value


1 Like

Hi @Ciabi

Seems like we have a bug here, yes. I’ve registered an issue, will be fixed in a next patch release of XP.

For now I suggest you run modify after you create a content, so that you don’t have to remove the default value from the schema:

var contentLib = require('/lib/xp/content');

var content = contentLib.create({
    name: 'myContent',
    parentPath: '/',
    displayName: 'My Content',
    contentType: '',
    data: {
        "date": "2020-06-02"

    key: content._id,
    branch: 'draft',
    editor: function (c) { = '2020-06-02';
        return c;
1 Like