Skip to content

'date' as input field type produces 'Invalid type, expected date' #709

Open
@repolevedavaj

Description

@repolevedavaj

First: Thanks for this really cool and easy to use framework!

I would like to use a input field of type 'date' to support browser specific date picker implementations, but it always shows the error 'Invalid type, expected date' and i do not know where this comes from. If I insert an date input field manually and bind it with ng-model to a date object, it seems no problem.

I use the following schema

{
    type: "object",
    properties: {
        birthday: {
            type: "date"
        }
    }
}

form

[
    "*"
]

and configure the schemaFormProvider like this:

angular.module('schemaForm').config(['schemaFormProvider', 'schemaFormDecoratorsProvider', 'sfPathProvider',
    function (schemaFormProvider, schemaFormDecoratorsProvider, sfPathProvider) {
        var datepicker = function (name, schema, options) {
            if (schema.type === 'date') {
                var f = schemaFormProvider.stdFormObj(name, schema, options);
                f.key = options.path;
                f.type = 'date';
                options.lookup[sfPathProvider.stringify(options.path)] = f;
                return f;
            }
        };
        schemaFormProvider.defaults.date = [];
        schemaFormProvider.defaults.date.unshift(datepicker);
    }
]);

Could you tell me where I am going wrong?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions