Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3328 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3328 Rev 3329
Línea 18... Línea 18...
18
  values = {}
18
  values = {}
19
}) {
19
}) {
20
  const {
20
  const {
21
    control,
21
    control,
22
    formState: { errors, isSubmitting },
22
    formState: { errors, isSubmitting },
-
 
23
    watch,
23
    handleSubmit
24
    handleSubmit
24
  } = useForm({
25
  } = useForm({
25
    defaultValues,
26
    defaultValues,
26
    values: values && { ...values, date: new Date(values.date) }
27
    values
27
  })
28
  })
-
 
29
  const watchedDate = watch('date', new Date())
Línea 28... Línea 30...
28
 
30
 
29
  return (
31
  return (
30
    <Form onSubmit={handleSubmit(onSubmit)}>
32
    <Form onSubmit={handleSubmit(onSubmit)}>
31
      <LoadingWrapper loading={isSubmitting} displayChildren>
33
      <LoadingWrapper loading={isSubmitting} displayChildren>
Línea 48... Línea 50...
48
 
50
 
49
        <DatetimePicker
51
        <DatetimePicker
50
          label='Fecha'
52
          label='Fecha'
51
          name='date'
53
          name='date'
-
 
54
          control={control}
52
          control={control}
55
          defaultValue={new Date(watchedDate)}
53
          rules={{
56
          rules={{
54
            required: { value: true, message: 'La fecha es requerida' },
57
            required: { value: true, message: 'La fecha es requerida' },
55
            validate: {
58
            validate: {
56
              beGreaterThanToday: (value) =>
59
              beGreaterThanToday: (value) =>