Skip to content

Commit

Permalink
Merge pull request #3665 from navikt/bugfix/datofelter-gir-feil-dato
Browse files Browse the repository at this point in the history
Fikset datofelter som gir feil dato
  • Loading branch information
betsytraran authored Oct 29, 2024
2 parents 0576e59 + 8c78774 commit 0230be6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Adresse = ({ formMethods, path }) => {
return (
<div className="flexbox--full-width">
{visAdresse ? (
<Button onClick={setSkjulAdresse} kind="collapse">
<Button onClick={setSkjulAdresse} kind="chevron-up">
SKJUL ADRESSE-VALG
</Button>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ export const Personinformasjon = ({ formMethods }) => {
<Vergemaal formMethods={formMethods} />
</Kategori>

<Kategori title="Fullmakt" vis={fullmaktPath}>
<Fullmakt formMethods={formMethods} />
</Kategori>

<Kategori title="Sikkerhetstiltak" vis={sikkerhetstiltakPath}>
<Sikkerhetstiltak formMethods={formMethods} />
</Kategori>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,9 @@ export const Sikkerhetstiltak = ({ formMethods }: SikkerhetstiltakProps) => {
<FormDatepicker
name={`${path}.gyldigFraOgMed`}
label="Sikkerhetstiltak starter"
onChange={(date: Date) => {
handleValueChange(date, 'gyldigFraOgMed', idx)
}}
/>
</InputWarning>
<FormDatepicker
name={`${path}.gyldigTilOgMed`}
label="Sikkerhetstiltak opphører"
onChange={(date: Date) => {
handleValueChange(date, 'gyldigTilOgMed', idx)
}}
/>
<FormDatepicker name={`${path}.gyldigTilOgMed`} label="Sikkerhetstiltak opphører" />
<AvansertForm path={path} kanVelgeMaster={false} />
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ export const SkjermingForm = ({ formMethods }) => {
}
}

const settFormDate = (value, path) => {
formMethods.setValue(`skjerming.${path}`, value)
formMethods.trigger(`skjerming.${path}`)
}

const harSkjerming = HarAktivSkjerming()

return (
Expand All @@ -33,21 +28,11 @@ export const SkjermingForm = ({ formMethods }) => {
name="skjerming.egenAnsattDatoFom"
label="Skjerming fra"
disabled={harSkjerming}
onChange={(date) => {
settFormDate(date, 'egenAnsattDatoFom')
}}
maxDate={new Date()}
visHvisAvhuket
/>
{harSkjerming && (
<FormDatepicker
name="skjerming.egenAnsattDatoTom"
label="Skjerming til"
onChange={(date) => {
settFormDate(date, 'egenAnsattDatoTom')
}}
visHvisAvhuket
/>
<FormDatepicker name="skjerming.egenAnsattDatoTom" label="Skjerming til" visHvisAvhuket />
)}
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ export const fixTimezone = (date: Date) => {
if (!isDate(date) || date.getUTCHours() === 0) {
return date
}
const tzoffset = new Date().getTimezoneOffset() * 60000 //offset in milliseconds

const erSommertid = date?.toString().includes('sommertid')

// Denne funker naar dagens dato er vintertid, mulig vi maa ha en ekstra sjekk naar vi er paa sommertid
const tzoffset = erSommertid
? new Date().getTimezoneOffset() * 60000 * 2
: new Date().getTimezoneOffset() * 60000

return new Date(date.getTime() - tzoffset)
}

Expand Down

0 comments on commit 0230be6

Please sign in to comment.