How to use the @webiny/commodo.date function in @webiny/commodo

To help you get started, we’ve selected a few @webiny/commodo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / packages / api-page-builder / src / plugins / models / pbSettings.model.js View on Github external
const step = () =>
    fields({
        value: {},
        instanceOf: flow(
            withFields({
                started: boolean({ value: false }),
                startedOn: date(),
                completed: boolean({ value: false }),
                completedOn: date()
            }),
            withProps({
                markAsStarted() {
                    this.started = true;
                    this.startedOn = new Date();
                },
                markAsCompleted() {
                    this.completed = true;
                    this.completedOn = new Date();
                }
            })
        )()
    });
github webiny / webiny-js / packages / api-forms / src / plugins / models / form.model.js View on Github external
list: true,
                    value: [],
                    instanceOf: FormFieldsModel
                })
            ),
            layout: onSet(value => (instance.locked ? instance.layout : value))(
                object({ value: [] })
            ),
            stats: skipOnPopulate()(fields({ instanceOf: FormStatsModel, value: {} })),
            settings: onSet(value => (instance.locked ? instance.settings : value))(
                fields({ instanceOf: FormSettingsModel, value: {} })
            ),
            triggers: onSet(value => (instance.locked ? instance.triggers : value))(object()),
            version: number(),
            parent: string(),
            publishedOn: date(),
            published: onSet(value => {
                if (value) {
                    instance.publishedOn = new Date();
                    if (!instance.locked) {
                        instance.locked = true;
                    }
                }

                return value;
            })(boolean()),
            locked: skipOnPopulate()(boolean({ value: false }))
        })),
        withHooks({
github webiny / webiny-js / packages / api-forms / src / plugins / models / formSubmission.model.js View on Github external
ip: string({ validation: validation.create("required") }),
                    locale: string({ validation: validation.create("required") }),
                    submittedOn: skipOnPopulate()(
                        date({ validation: validation.create("required") })
                    )
                })()
            }),
            logs: fields({
                list: true,
                value: [],
                instanceOf: withFields({
                    type: string({
                        validation: validation.create("required,in:error:warning:info:success"),
                        message: string(),
                        data: object(),
                        createdOn: date({ value: new Date() })
                    })
                })()
            })
        })),
        withHooks({
github webiny / webiny-js / packages / api-page-builder / src / plugins / models / pbSettings.model.js View on Github external
const step = () =>
    fields({
        value: {},
        instanceOf: flow(
            withFields({
                started: boolean({ value: false }),
                startedOn: date(),
                completed: boolean({ value: false }),
                completedOn: date()
            }),
            withProps({
                markAsStarted() {
                    this.started = true;
                    this.startedOn = new Date();
                },
                markAsCompleted() {
                    this.completed = true;
                    this.completedOn = new Date();
                }
            })
        )()
    });