willba-component-library 0.2.21 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/utils/parseDate.d.ts +2 -1
- package/lib/index.esm.js +12 -12
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +12 -12
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +12 -12
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FilterCalendar/FilterCalendar.tsx +2 -0
- package/src/components/FilterCalendar/hooks/useFilterCalendar.ts +0 -5
- package/src/core/utils/parseDate.tsx +10 -2
- package/src/locales/en/common.json +2 -2
- package/src/locales/fi/common.json +4 -4
package/package.json
CHANGED
|
@@ -85,6 +85,7 @@ export default function FilterCalendar({
|
|
|
85
85
|
{parseDate({
|
|
86
86
|
date: calendarRange?.from,
|
|
87
87
|
dateFormat: 'EEEEEE d.M.yyyy',
|
|
88
|
+
language,
|
|
88
89
|
}) || t('common:checkIn')}
|
|
89
90
|
</span>
|
|
90
91
|
<span className={`will-calendar-footer-dates-separator`}>
|
|
@@ -94,6 +95,7 @@ export default function FilterCalendar({
|
|
|
94
95
|
{parseDate({
|
|
95
96
|
date: calendarRange?.to,
|
|
96
97
|
dateFormat: 'EEEEEE d.M.yyyy',
|
|
98
|
+
language,
|
|
97
99
|
}) || t('common:checkOut')}
|
|
98
100
|
</span>
|
|
99
101
|
</div>
|
|
@@ -27,11 +27,6 @@ export const useFilterCalendar = ({ onSubmit, setToggleCalendar }: Props) => {
|
|
|
27
27
|
}
|
|
28
28
|
}, [])
|
|
29
29
|
|
|
30
|
-
// TODO - handle the onSubmit on calendar open
|
|
31
|
-
// useEffect(() => {
|
|
32
|
-
// onSubmit(calendarRange)
|
|
33
|
-
// }, [])
|
|
34
|
-
|
|
35
30
|
const handleSubmit = () => {
|
|
36
31
|
setToggleCalendar(false)
|
|
37
32
|
return onSubmit(calendarRange)
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { format } from 'date-fns'
|
|
2
|
+
import { fi, enUS } from 'date-fns/locale'
|
|
2
3
|
|
|
3
4
|
type Props = {
|
|
4
5
|
date?: Date
|
|
5
6
|
dateFormat?: string
|
|
7
|
+
language?: string
|
|
6
8
|
}
|
|
7
|
-
export const parseDate = ({
|
|
8
|
-
|
|
9
|
+
export const parseDate = ({
|
|
10
|
+
date,
|
|
11
|
+
dateFormat = 'dd.MM.yyyy',
|
|
12
|
+
language,
|
|
13
|
+
}: Props) => {
|
|
14
|
+
return date
|
|
15
|
+
? format(date, dateFormat, { locale: language === 'en' ? enUS : fi })
|
|
16
|
+
: null
|
|
9
17
|
}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"checkIn": "check-in",
|
|
5
5
|
"checkOut": "check-out",
|
|
6
6
|
"search": "Hae",
|
|
7
|
-
"apply": "
|
|
8
|
-
"clearDates": "
|
|
9
|
-
"noCheckIn": "
|
|
10
|
-
"noCheckOut": "
|
|
7
|
+
"apply": "Aseta",
|
|
8
|
+
"clearDates": "Tyhjennä",
|
|
9
|
+
"noCheckIn": "Huone ei saatavilla",
|
|
10
|
+
"noCheckOut": "Uloskirjaus ei saatavilla"
|
|
11
11
|
}
|
|
12
12
|
|