Skip to content

Commit 0a685ea

Browse files
committed
- Bedre handling av react-hook-forms trigger sjekking
- Fikset date fra norsk bankkonto på ugyldig format, muligens andre steder - Gir rød input boks dersom feltet ikke validerer #deploy-test-frontend
1 parent 8212263 commit 0a685ea

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/select/Select.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ const P_FormSelect = ({ feil, ...props }: SelectProps) => {
200200
(errorContext?.showError || isTouched) &&
201201
(feil ||
202202
formMethods?.getFieldState(props.name)?.error ||
203-
formMethods?.getFieldState(props.fieldName)?.error)
203+
formMethods?.getFieldState(props.fieldName)?.error ||
204+
formMethods?.getFieldState(`manual.${props.name}`)?.error)
204205
}
205206
{...props}
206207
/>

apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/textInput/TextInput.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ export const TextInput = React.forwardRef(
9494
const input = props.input || props.value
9595
const [fieldValue, setFieldValue] = useState(props.input || watch(name) || '')
9696
const isTouched = _.has(touchedFields, name) || _.has(touchedFields, fieldName)
97-
const feil = getFieldState(name)?.error || getFieldState(fieldName)?.error
97+
const feil =
98+
getFieldState(name)?.error ||
99+
getFieldState(fieldName)?.error ||
100+
getFieldState(`manual.${name}`)?.error
98101
const visFeil = feil && (errorContext?.showError || isTouched)
99102
const css = cn('skjemaelement__input', className, {
100103
'skjemaelement__input--harFeil': visFeil,

apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export const formatDate = (date: any, formatString?: string) => {
3030
if (!date) {
3131
return date
3232
}
33+
if (date?.length > 19) {
34+
date = date.substring(0, 19)
35+
}
3336
if (isDate(date)) {
3437
const customdayjs = initDayjs()
3538
return customdayjs(date).format(formatString || 'DD.MM.YYYY')

0 commit comments

Comments
 (0)