Skip to content

Commit

Permalink
- Bedre handling av react-hook-forms trigger sjekking
Browse files Browse the repository at this point in the history
- Fikset date fra norsk bankkonto på ugyldig format, muligens andre steder
- Gir rød input boks dersom feltet ikke validerer
#deploy-test-frontend
  • Loading branch information
stigus committed Nov 26, 2024
1 parent 8212263 commit 0a685ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ const P_FormSelect = ({ feil, ...props }: SelectProps) => {
(errorContext?.showError || isTouched) &&
(feil ||
formMethods?.getFieldState(props.name)?.error ||
formMethods?.getFieldState(props.fieldName)?.error)
formMethods?.getFieldState(props.fieldName)?.error ||
formMethods?.getFieldState(`manual.${props.name}`)?.error)
}
{...props}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ export const TextInput = React.forwardRef(
const input = props.input || props.value
const [fieldValue, setFieldValue] = useState(props.input || watch(name) || '')
const isTouched = _.has(touchedFields, name) || _.has(touchedFields, fieldName)
const feil = getFieldState(name)?.error || getFieldState(fieldName)?.error
const feil =
getFieldState(name)?.error ||
getFieldState(fieldName)?.error ||
getFieldState(`manual.${name}`)?.error
const visFeil = feil && (errorContext?.showError || isTouched)
const css = cn('skjemaelement__input', className, {
'skjemaelement__input--harFeil': visFeil,
Expand Down
3 changes: 3 additions & 0 deletions apps/dolly-frontend/src/main/js/src/utils/DataFormatter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export const formatDate = (date: any, formatString?: string) => {
if (!date) {
return date
}
if (date?.length > 19) {
date = date.substring(0, 19)
}
if (isDate(date)) {
const customdayjs = initDayjs()
return customdayjs(date).format(formatString || 'DD.MM.YYYY')
Expand Down

0 comments on commit 0a685ea

Please sign in to comment.