How to use the @nakedobjects/restful-objects.isDateOrDateTime function in @nakedobjects/restful-objects

To help you get started, we’ve selected a few @nakedobjects/restful-objects 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 NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / cicero / src / cicero-commands / enter.ts View on Github external
private handleFreeForm(field: Ro.IField, fieldEntry: string) {
        if (field.isScalar()) {

            const mandatoryError = validateMandatory(field, fieldEntry);

            if (mandatoryError) {
                return this.returnResult('', this.validationMessage(mandatoryError, new Ro.Value(''), field.extensions().friendlyName()));
            }

            let value = new Ro.Value(fieldEntry);
            if (Ro.isDateOrDateTime(field)) {
                const dt = validateDate(fieldEntry, supportedDateFormats);

                if (dt) {
                    value = new Ro.Value(Ro.toDateString(dt.toDate()));
                }
            }

            // if optional but empty always valid
            if (fieldEntry != null && fieldEntry !== '') {

                const remoteMask = field.extensions().mask();
                const localFilter = this.mask.toLocalFilter(remoteMask, field.extensions().format()!);

                const validateError = validateMandatoryAgainstType(field, fieldEntry, localFilter);

                if (validateError) {