forFormCast() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .transform((value) => value ? moment(value).format('YYYY-MM-DD') : null, ); return yupChain; }
forImport() { let yupChain = yup .mixed() .nullable(true) .label(this.label); if (this.required) { yupChain = yupChain.required(); } return yupChain; }
forFilter() { return yup .mixed() .nullable(true) .label(this.label) .test( 'is-date', i18n('validation.mixed.default'), (value) => { if (!value) { return true; } return moment(value, 'YYYY-MM-DD').isValid(); }, ) .transform( (value) => value ? moment(value).format('YYYY-MM-DD') : null, ); }
forFilter() { return yup .array() .of( yup .mixed() .nullable(true) .label(this.label) .test( 'is-date', i18n('validation.mixed.default'), (value) => { if (!value) { return true; } return moment(value, 'YYYY-MM-DD').isValid(); }, ) .transform( (value) => value ? moment(value).format('YYYY-MM-DD') : null, ), ) .label(this.label); }
forImport() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .test( 'is-date', i18n('validation.mixed.default'), (value) => { if (!value) { return true; } return moment(value, 'YYYY-MM-DD').isValid(); }, ); if (this.required) { yupChain = yupChain.required(); } return yupChain; }
forForm() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .transform((value, originalValue) => { if (!originalValue) { return null; } return originalValue.id; }); if (this.required) { yupChain = yupChain.required(); } return yupChain; }
forFormCast() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .transform((value) => (value ? moment(value) : null)); return yupChain; }
forForm() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .test( 'is-date', i18n('validation.mixed.default'), (value) => { if (!value) { return true; } return moment(value, 'YYYY-MM-DD').isValid(); }, ) .transform( (value) => value ? moment(value).format('YYYY-MM-DD') : null, ); if (this.required) { yupChain = yupChain.required(); } return yupChain; }
forImport() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .transform((value, originalValue) => originalValue ? moment( originalValue, 'YYYY-MM-DD HH:mm', ).toISOString() : null, ); if (this.required) { yupChain = yupChain.required(); } return yupChain; }
forFormCast() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .transform((value, originalValue) => { if (!originalValue) { return null; } return originalValue.id; }); return yupChain; }
forFilterCast() { return yup .mixed() .nullable(true) .label(this.label) .transform((value) => value ? moment(value).format('YYYY-MM-DD') : null, ); }
forImport() { let yupChain = yup .mixed() .nullable(true) .label(this.label); if (this.required) { yupChain = yupChain.required(); } return yupChain; }
forForm() { let yupChain = yup .mixed() .nullable(true) .label(this.label); if (this.required) { yupChain = yupChain.required(); } return yupChain; }
forImport() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .transform( (value, originalValue) => originalValue ? moment( originalValue, 'YYYY-MM-DD HH:mm', ).toISOString() : null, ); if (this.required) { yupChain = yupChain.required(); } return yupChain; }
forImport() { let yupChain = yup .mixed() .nullable(true) .label(this.label) .test( 'is-date', i18n('validation.mixed.default'), (value) => { if (!value) { return true; } return moment(value, 'YYYY-MM-DD').isValid(); }, ); if (this.required) { yupChain = yupChain.required(); } return yupChain; }