1 import * as yup from 'yup';
3 import { parseTime } from '../helpers/Result';
5 yup.addMethod(yup.string, 'time', function (errorMessage) {
6 return this.test('test-time-format', errorMessage, function (value) {
7 const { path, createError } = this;
10 !isNaN(parseTime(value)) ||
11 createError({ path, message: errorMessage || 'validation.error.time' })
18 default: 'validation.error.general',
19 required: 'validation.error.required',
22 time: 'validation.error.time',
23 url: 'validation.error.url',