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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "willba-component-library",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "description": "A custom UI component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -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 = ({ date, dateFormat = 'dd.MM.yyyy' }: Props) => {
8
- return date ? format(date, dateFormat) : null
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
  }
@@ -6,6 +6,6 @@
6
6
  "search": "Search",
7
7
  "apply": "Apply",
8
8
  "clearDates": "Clear dates",
9
- "noCheckIn": "No check-in",
10
- "noCheckOut": "No check-out"
9
+ "noCheckIn": "Room not available",
10
+ "noCheckOut": "Check-out not available"
11
11
  }
@@ -4,9 +4,9 @@
4
4
  "checkIn": "check-in",
5
5
  "checkOut": "check-out",
6
6
  "search": "Hae",
7
- "apply": "Apply",
8
- "clearDates": "Clear dates",
9
- "noCheckIn": "No check-in",
10
- "noCheckOut": "No check-out"
7
+ "apply": "Aseta",
8
+ "clearDates": "Tyhjennä",
9
+ "noCheckIn": "Huone ei saatavilla",
10
+ "noCheckOut": "Uloskirjaus ei saatavilla"
11
11
  }
12
12