Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 16716 Rev 16717
Línea 131... Línea 131...
131
      register('description', { required: 'El campo es requerido' })
131
      register('description', { required: 'El campo es requerido' })
132
    }
132
    }
Línea 133... Línea 133...
133
 
133
 
134
    if (modalType === shareModalTypes.SURVEY) {
134
    if (modalType === shareModalTypes.SURVEY) {
135
      unregister('description')
135
      unregister('description')
-
 
136
      register('duration_days')
-
 
137
      register('duration_hours')
136
      register('date')
138
      register('duration_minutes')
137
    }
139
    }
Línea 138... Línea 140...
138
  }, [modalType])
140
  }, [modalType])
139
 
141
 
Línea 204... Línea 206...
204
  )
206
  )
205
}
207
}
Línea 206... Línea 208...
206
 
208
 
207
const SurveyForm = ({ register, setValue }) => {
209
const SurveyForm = ({ register, setValue }) => {
208
  const [selectedDate, setSelectedDate] = useState(null)
210
  const [selectedDate, setSelectedDate] = useState(null)
-
 
211
  const [daysDifference, setDaysDifference] = useState({
-
 
212
    days: null,
-
 
213
    hours: null,
-
 
214
    minutes: null
209
  const [daysDifference, setDaysDifference] = useState(null)
215
  })
Línea 210... Línea 216...
210
  const [optionsNumber, setOptionsNumber] = useState(2)
216
  const [optionsNumber, setOptionsNumber] = useState(2)
211
 
217
 
212
  const options = [
218
  const options = [
Línea 233... Línea 239...
233
    if (selected) {
239
    if (selected) {
234
      const currentDate = new Date()
240
      const currentDate = new Date()
235
      const selectedDt = new Date(selected.format('YYYY-MM-DD'))
241
      const selectedDt = new Date(selected.format('YYYY-MM-DD'))
236
      const timeDiff = selectedDt.getTime() - currentDate.getTime()
242
      const timeDiff = selectedDt.getTime() - currentDate.getTime()
237
      const daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24))
243
      const daysDiff = Math.ceil(timeDiff / (1000 * 60 * 60 * 24))
-
 
244
      const hoursDiff = Math.floor(
-
 
245
        (diferenciaEnTiempo % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
-
 
246
      )
-
 
247
      const minutesDiff = Math.floor(
-
 
248
        (diferenciaEnTiempo % (1000 * 60 * 60)) / (1000 * 60)
-
 
249
      )
238
      setDaysDifference(daysDiff)
250
      setDaysDifference({
-
 
251
        days: daysDiff,
-
 
252
        hours: hoursDiff,
-
 
253
        minutes: minutesDiff
-
 
254
      })
239
    } else {
255
    } else {
240
      setDaysDifference(null)
256
      setDaysDifference(null)
241
    }
257
    }
242
  }
258
  }
Línea 248... Línea 264...
248
  const removeOption = () => {
264
  const removeOption = () => {
249
    setOptionsNumber(optionsNumber - 1)
265
    setOptionsNumber(optionsNumber - 1)
250
  }
266
  }
Línea 251... Línea 267...
251
 
267
 
252
  useEffect(() => {
268
  useEffect(() => {
-
 
269
    setValue('duration_days', daysDifference.days)
-
 
270
    setValue('duration_hours', daysDifference.hours)
253
    setValue('date', daysDifference)
271
    setValue('duration_minutes', daysDifference.minutes)
Línea 254... Línea 272...
254
  }, [daysDifference])
272
  }, [daysDifference])
255
 
273
 
256
  return (
274
  return (