Merged in fix/SW-2801-correct-date-formats (pull request #2400)

fix(SW-2801): Added lang specific date formats

* fix(SW-2801): Added lang specific date formats

* fix: wrong type import


Approved-by: Michael Zetterberg
This commit is contained in:
Tobias Johansson
2025-06-25 11:12:28 +00:00
parent c0efbd17ff
commit 8272327993
18 changed files with 114 additions and 33 deletions

View File

@@ -3,6 +3,7 @@ import { useCallback, useEffect, useRef, useState } from "react"
import { useFormContext, useWatch } from "react-hook-form"
import { useIntl } from "react-intl"
import { longDateFormat } from "@/constants/dateFormats"
import { dt } from "@/lib/dt"
import Body from "@/components/TempDesignSystem/Text/Body"
@@ -128,9 +129,9 @@ export default function DatePickerForm({ name = "date" }: DatePickerFormProps) {
const selectedFromDate = dt(selectedDate.fromDate)
.locale(lang)
.format("ddd D MMM")
.format(longDateFormat[lang])
const selectedToDate = !!selectedDate.toDate
? dt(selectedDate.toDate).locale(lang).format("ddd D MMM")
? dt(selectedDate.toDate).locale(lang).format(longDateFormat[lang])
: ""
return (