react-native-paper-dates 0.6.0 → 0.8.2

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.
Files changed (120) hide show
  1. package/README.md +20 -5
  2. package/lib/commonjs/Date/CalendarEdit.js +3 -3
  3. package/lib/commonjs/Date/CalendarEdit.js.map +1 -1
  4. package/lib/commonjs/Date/CalendarHeader.js +6 -8
  5. package/lib/commonjs/Date/CalendarHeader.js.map +1 -1
  6. package/lib/commonjs/Date/DatePickerInput.js +8 -9
  7. package/lib/commonjs/Date/DatePickerInput.js.map +1 -1
  8. package/lib/commonjs/Date/DatePickerModalContent.js +4 -0
  9. package/lib/commonjs/Date/DatePickerModalContent.js.map +1 -1
  10. package/lib/commonjs/Date/DatePickerModalContentHeader.js +5 -6
  11. package/lib/commonjs/Date/DatePickerModalContentHeader.js.map +1 -1
  12. package/lib/commonjs/Date/DatePickerModalHeader.js +5 -4
  13. package/lib/commonjs/Date/DatePickerModalHeader.js.map +1 -1
  14. package/lib/commonjs/Date/DateRangeInput.js +1 -4
  15. package/lib/commonjs/Date/DateRangeInput.js.map +1 -1
  16. package/lib/commonjs/Date/Day.js +2 -4
  17. package/lib/commonjs/Date/Day.js.map +1 -1
  18. package/lib/commonjs/Date/Month.js +4 -8
  19. package/lib/commonjs/Date/Month.js.map +1 -1
  20. package/lib/commonjs/Date/YearPicker.js +3 -4
  21. package/lib/commonjs/Date/YearPicker.js.map +1 -1
  22. package/lib/commonjs/Date/inputUtils.js +1 -1
  23. package/lib/commonjs/Date/inputUtils.js.map +1 -1
  24. package/lib/commonjs/Time/AnalogClock.js +4 -0
  25. package/lib/commonjs/Time/AnalogClock.js.map +1 -1
  26. package/lib/commonjs/Time/TimeInput.js +1 -4
  27. package/lib/commonjs/Time/TimeInput.js.map +1 -1
  28. package/lib/commonjs/Time/TimePickerModal.js +7 -7
  29. package/lib/commonjs/Time/TimePickerModal.js.map +1 -1
  30. package/lib/commonjs/index.js +9 -0
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/commonjs/translations/de.js +25 -0
  33. package/lib/commonjs/translations/de.js.map +1 -0
  34. package/lib/commonjs/translations/en.js +9 -4
  35. package/lib/commonjs/translations/en.js.map +1 -1
  36. package/lib/commonjs/translations/enGB.js +9 -4
  37. package/lib/commonjs/translations/enGB.js.map +1 -1
  38. package/lib/commonjs/translations/nl.js +9 -4
  39. package/lib/commonjs/translations/nl.js.map +1 -1
  40. package/lib/commonjs/translations/pl.js +9 -4
  41. package/lib/commonjs/translations/pl.js.map +1 -1
  42. package/lib/commonjs/translations/pt.js +25 -0
  43. package/lib/commonjs/translations/pt.js.map +1 -0
  44. package/lib/commonjs/translations/utils.js.map +1 -1
  45. package/lib/module/Date/CalendarEdit.js +3 -3
  46. package/lib/module/Date/CalendarEdit.js.map +1 -1
  47. package/lib/module/Date/CalendarHeader.js +5 -8
  48. package/lib/module/Date/CalendarHeader.js.map +1 -1
  49. package/lib/module/Date/DatePickerInput.js +8 -9
  50. package/lib/module/Date/DatePickerInput.js.map +1 -1
  51. package/lib/module/Date/DatePickerModalContent.js +4 -0
  52. package/lib/module/Date/DatePickerModalContent.js.map +1 -1
  53. package/lib/module/Date/DatePickerModalContentHeader.js +5 -6
  54. package/lib/module/Date/DatePickerModalContentHeader.js.map +1 -1
  55. package/lib/module/Date/DatePickerModalHeader.js +5 -4
  56. package/lib/module/Date/DatePickerModalHeader.js.map +1 -1
  57. package/lib/module/Date/DateRangeInput.js +1 -4
  58. package/lib/module/Date/DateRangeInput.js.map +1 -1
  59. package/lib/module/Date/Day.js +2 -4
  60. package/lib/module/Date/Day.js.map +1 -1
  61. package/lib/module/Date/Month.js +4 -8
  62. package/lib/module/Date/Month.js.map +1 -1
  63. package/lib/module/Date/YearPicker.js +3 -4
  64. package/lib/module/Date/YearPicker.js.map +1 -1
  65. package/lib/module/Date/inputUtils.js +1 -1
  66. package/lib/module/Date/inputUtils.js.map +1 -1
  67. package/lib/module/Time/AnalogClock.js +4 -0
  68. package/lib/module/Time/AnalogClock.js.map +1 -1
  69. package/lib/module/Time/TimeInput.js +1 -4
  70. package/lib/module/Time/TimeInput.js.map +1 -1
  71. package/lib/module/Time/TimePickerModal.js +7 -7
  72. package/lib/module/Time/TimePickerModal.js.map +1 -1
  73. package/lib/module/index.js +1 -0
  74. package/lib/module/index.js.map +1 -1
  75. package/lib/module/translations/de.js +18 -0
  76. package/lib/module/translations/de.js.map +1 -0
  77. package/lib/module/translations/en.js +9 -4
  78. package/lib/module/translations/en.js.map +1 -1
  79. package/lib/module/translations/enGB.js +9 -4
  80. package/lib/module/translations/enGB.js.map +1 -1
  81. package/lib/module/translations/nl.js +9 -4
  82. package/lib/module/translations/nl.js.map +1 -1
  83. package/lib/module/translations/pl.js +9 -4
  84. package/lib/module/translations/pl.js.map +1 -1
  85. package/lib/module/translations/pt.js +18 -0
  86. package/lib/module/translations/pt.js.map +1 -0
  87. package/lib/module/translations/utils.js.map +1 -1
  88. package/lib/typescript/Date/DatePickerInput.d.ts +8 -8
  89. package/lib/typescript/Date/DatePickerModalContentHeader.d.ts +1 -0
  90. package/lib/typescript/Date/DatePickerModalHeader.d.ts +1 -0
  91. package/lib/typescript/TextInputMask.d.ts +3 -3
  92. package/lib/typescript/Time/TimePickerModal.d.ts +2 -1
  93. package/lib/typescript/index.d.ts +1 -0
  94. package/lib/typescript/translations/de.d.ts +3 -0
  95. package/lib/typescript/translations/pt.d.ts +3 -0
  96. package/lib/typescript/translations/utils.d.ts +9 -4
  97. package/package.json +3 -8
  98. package/src/Date/CalendarEdit.tsx +3 -3
  99. package/src/Date/CalendarHeader.tsx +3 -6
  100. package/src/Date/DatePickerInput.tsx +13 -8
  101. package/src/Date/DatePickerModalContent.tsx +2 -0
  102. package/src/Date/DatePickerModalContentHeader.tsx +10 -6
  103. package/src/Date/DatePickerModalHeader.tsx +3 -3
  104. package/src/Date/DateRangeInput.tsx +1 -7
  105. package/src/Date/Day.tsx +1 -3
  106. package/src/Date/Month.tsx +2 -6
  107. package/src/Date/YearPicker.tsx +2 -3
  108. package/src/Date/inputUtils.ts +13 -9
  109. package/src/Time/AnalogClock.tsx +4 -0
  110. package/src/Time/TimeInput.tsx +0 -3
  111. package/src/Time/TimePickerModal.tsx +7 -5
  112. package/src/index.tsx +1 -0
  113. package/src/translations/de.ts +20 -0
  114. package/src/translations/en.ts +10 -4
  115. package/src/translations/enGB.ts +10 -4
  116. package/src/translations/nl.ts +10 -4
  117. package/src/translations/pl.ts +10 -4
  118. package/src/translations/pt.ts +21 -0
  119. package/src/translations/utils.ts +10 -5
  120. package/src/.DS_Store +0 -0
@@ -20,7 +20,7 @@ function DatePickerInput(
20
20
  withModal = true,
21
21
  withDateFormatInLabel = true,
22
22
  ...rest
23
- }: Omit<React.ComponentProps<typeof TextInput>, 'value' | 'onChange'> & {
23
+ }: {
24
24
  inputMode: 'start' | 'end'
25
25
  locale: string
26
26
  onChange: (date: Date | undefined) => void
@@ -28,7 +28,10 @@ function DatePickerInput(
28
28
  validRange?: ValidRangeType | undefined
29
29
  withModal?: boolean
30
30
  withDateFormatInLabel?: boolean
31
- },
31
+ } & Omit<
32
+ React.ComponentProps<typeof TextInput>,
33
+ 'value' | 'onChange' | 'onChangeText'
34
+ >,
32
35
  ref: any
33
36
  ) {
34
37
  const theme = useTheme()
@@ -59,7 +62,12 @@ function DatePickerInput(
59
62
  <TextInputWithMask
60
63
  {...rest}
61
64
  ref={ref}
62
- label={getLabel({ label, inputFormat, withDateFormatInLabel })}
65
+ label={getLabel({
66
+ // TODO: support label components?
67
+ label: label as any,
68
+ inputFormat,
69
+ withDateFormatInLabel,
70
+ })}
63
71
  value={formattedValue}
64
72
  keyboardType={'number-pad'}
65
73
  placeholder={inputFormat}
@@ -75,9 +83,6 @@ function DatePickerInput(
75
83
  style={styles.calendarButton}
76
84
  icon="calendar"
77
85
  onPress={() => setVisible(true)}
78
- // RN types bug
79
- hasTVPreferredFocus={undefined}
80
- tvParallaxProperties={undefined}
81
86
  />
82
87
  ) : null}
83
88
  </View>
@@ -94,6 +99,7 @@ function DatePickerInput(
94
99
  onConfirm={onInnerConfirm}
95
100
  locale={locale}
96
101
  dateMode={inputMode}
102
+ validRange={validRange}
97
103
  />
98
104
  ) : null}
99
105
  </>
@@ -122,11 +128,10 @@ const styles = StyleSheet.create({
122
128
  position: 'relative',
123
129
  alignItems: 'center',
124
130
  flexGrow: 1,
125
- alignSelf: 'flex-start',
126
131
  },
127
132
  input: {
128
133
  flexGrow: 1,
129
134
  },
130
- calendarButton: { position: 'absolute', right: 0 },
135
+ calendarButton: { position: 'absolute', right: 0, zIndex: 10 },
131
136
  })
132
137
  export default React.forwardRef(DatePickerInput)
@@ -142,6 +142,7 @@ export function DatePickerModalContent(
142
142
  onSave={onInnerConfirm}
143
143
  onDismiss={onDismiss}
144
144
  saveLabel={props.saveLabel}
145
+ uppercase={props.uppercase ?? true}
145
146
  disableSafeTop={disableSafeTop}
146
147
  />
147
148
  <DatePickerModalContentHeader
@@ -155,6 +156,7 @@ export function DatePickerModalContent(
155
156
  moreLabel={props.moreLabel}
156
157
  startLabel={props.startLabel}
157
158
  endLabel={props.endLabel}
159
+ uppercase={props.uppercase ?? true}
158
160
  locale={locale}
159
161
  />
160
162
  </DatePickerModalHeaderBackground>
@@ -12,6 +12,7 @@ export interface HeaderPickProps {
12
12
  label?: string
13
13
  emptyLabel?: string
14
14
  saveLabel?: string
15
+ uppercase?: boolean
15
16
  headerSeparator?: string
16
17
  startLabel?: string
17
18
  endLabel?: string
@@ -48,7 +49,7 @@ function getLabel(
48
49
  export default function DatePickerModalContentHeader(
49
50
  props: HeaderContentProps
50
51
  ) {
51
- const { onToggle, collapsed, mode, moreLabel } = props
52
+ const { onToggle, collapsed, mode, moreLabel, uppercase } = props
52
53
 
53
54
  const label = getLabel(props.locale, props.mode, props.label)
54
55
 
@@ -57,8 +58,9 @@ export default function DatePickerModalContentHeader(
57
58
  return (
58
59
  <View style={[styles.header]}>
59
60
  <View>
60
- <Text style={[styles.label, { color }]}>{label.toUpperCase()}</Text>
61
-
61
+ <Text style={[styles.label, { color }]}>
62
+ {uppercase ? label.toUpperCase() : label}
63
+ </Text>
62
64
  <View style={styles.headerContentContainer}>
63
65
  {mode === 'range' ? (
64
66
  <HeaderContentRange {...props} color={color} />
@@ -79,11 +81,13 @@ export default function DatePickerModalContentHeader(
79
81
  {allowEditing ? (
80
82
  <IconButton
81
83
  icon={collapsed ? 'pencil' : 'calendar'}
84
+ accessibilityLabel={
85
+ collapsed
86
+ ? getTranslation(props.locale, 'typeInDate')
87
+ : getTranslation(props.locale, 'pickDateFromCalendar')
88
+ }
82
89
  color={color}
83
90
  onPress={onToggle}
84
- // RN types bug
85
- hasTVPreferredFocus={undefined}
86
- tvParallaxProperties={undefined}
87
91
  />
88
92
  ) : null}
89
93
  </View>
@@ -8,6 +8,7 @@ import { getTranslation } from '../translations/utils'
8
8
  export interface DatePickerModalHeaderProps {
9
9
  disableSafeTop?: boolean
10
10
  saveLabel?: string
11
+ uppercase?: boolean
11
12
  onDismiss: () => void
12
13
  onSave: () => void
13
14
  locale: string | undefined
@@ -31,17 +32,16 @@ export default function DatePickerModalHeader(
31
32
  <Appbar style={styles.appbarHeader}>
32
33
  <Appbar.Action
33
34
  icon="close"
35
+ accessibilityLabel={getTranslation(locale, 'close')}
34
36
  onPress={props.onDismiss}
35
37
  color={color}
36
38
  testID="react-native-paper-dates-close"
37
- // RN types bug
38
- hasTVPreferredFocus={undefined}
39
- tvParallaxProperties={undefined}
40
39
  />
41
40
  <Appbar.Content title={''} />
42
41
  <Button
43
42
  color={color}
44
43
  onPress={props.onSave}
44
+ uppercase={props.uppercase ?? true}
45
45
  testID="react-native-paper-dates-save"
46
46
  >
47
47
  {saveLabel}
@@ -50,13 +50,7 @@ export default function DateRangeInput({ locale }: { locale: string }) {
50
50
  <Text>Tot</Text>
51
51
  </View>
52
52
  <View>
53
- <IconButton
54
- icon="calendar"
55
- onPress={() => setVisible(true)}
56
- // RN types bug
57
- hasTVPreferredFocus={undefined}
58
- tvParallaxProperties={undefined}
59
- />
53
+ <IconButton icon="calendar" onPress={() => setVisible(true)} />
60
54
  <Text style={{ opacity: 0 }} accessible={false}>
61
55
  tot
62
56
  </Text>
package/src/Date/Day.tsx CHANGED
@@ -73,9 +73,7 @@ function Day(props: {
73
73
  styles.button,
74
74
  { backgroundColor: inRange ? selectColor : undefined },
75
75
  ]}
76
- // RN types bug
77
- hasTVPreferredFocus={undefined}
78
- tvParallaxProperties={undefined}
76
+ accessibilityRole="button"
79
77
  >
80
78
  <View
81
79
  style={[
@@ -260,15 +260,14 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
260
260
  <TouchableRipple
261
261
  disabled={!isHorizontal}
262
262
  onPress={isHorizontal ? () => onPressYear(year) : undefined}
263
+ accessibilityRole="button"
264
+ accessibilityLabel={`${monthName} ${year}`}
263
265
  style={[
264
266
  styles.yearButton,
265
267
  {
266
268
  borderRadius: roundness,
267
269
  },
268
270
  ]}
269
- // RN types bug
270
- hasTVPreferredFocus={undefined}
271
- tvParallaxProperties={undefined}
272
271
  >
273
272
  <View
274
273
  style={[
@@ -288,9 +287,6 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
288
287
  <IconButton
289
288
  onPress={isHorizontal ? () => onPressYear(year) : undefined}
290
289
  icon={selectingYear ? 'chevron-up' : 'chevron-down'}
291
- // RN types bug
292
- hasTVPreferredFocus={undefined}
293
- tvParallaxProperties={undefined}
294
290
  />
295
291
  </View>
296
292
  </View>
@@ -74,10 +74,9 @@ function YearPure({
74
74
  <View style={styles.year}>
75
75
  <TouchableRipple
76
76
  onPress={() => onPressYear(year)}
77
+ accessibilityRole="button"
78
+ accessibilityLabel={String(year)}
77
79
  style={styles.yearButton}
78
- // RN types bug
79
- hasTVPreferredFocus={undefined}
80
- tvParallaxProperties={undefined}
81
80
  >
82
81
  <View
83
82
  style={[
@@ -55,22 +55,26 @@ export default function useDateInput({
55
55
  let errors =
56
56
  validStart && validEnd
57
57
  ? [
58
- `${getTranslation(locale, 'mustBeBetween')} ${formatter.format(
59
- validStart
60
- )} - ${formatter.format(validEnd)}`,
58
+ `${getTranslation(
59
+ locale,
60
+ 'mustBeBetween',
61
+ () => 'mustBeBetween'
62
+ )(formatter.format(validStart), formatter.format(validEnd))}`,
61
63
  ]
62
64
  : [
63
65
  validStart
64
- ? `${getTranslation(
66
+ ? getTranslation(
65
67
  locale,
66
- 'mustBeHigherThan'
67
- )} ${formatter.format(validStart)}`
68
+ 'mustBeHigherThan',
69
+ () => 'mustBeHigherThan'
70
+ )(formatter.format(validStart))
68
71
  : '',
69
72
  validEnd
70
- ? `${getTranslation(
73
+ ? getTranslation(
71
74
  locale,
72
- 'mustBeLowerThan'
73
- )} ${formatter.format(validEnd)}`
75
+ 'mustBeLowerThan',
76
+ () => 'mustBeLowerThan'
77
+ )(formatter.format(validEnd))
74
78
  : '',
75
79
  ]
76
80
  setError(errors.filter((n) => n).join(' '))
@@ -70,11 +70,15 @@ function AnalogClock({
70
70
  let pickedHours = getHours(angle, previousHourType)
71
71
 
72
72
  let hours12AndPm = !hours24 && modeRef.current === 'PM'
73
+
73
74
  // Avoiding the "24h"
74
75
  // Should be 12h for 12 hours and PM mode
75
76
  if ((hours12AndPm || hours24) && pickedHours + 12 < 24) {
76
77
  pickedHours += 12
77
78
  }
79
+ if (modeRef.current === 'AM' && pickedHours === 12) {
80
+ pickedHours = 0
81
+ }
78
82
 
79
83
  if (pickedHours === 24) {
80
84
  pickedHours = 0
@@ -96,9 +96,6 @@ function TimeInput(
96
96
  rippleColor={Color(theme.colors.primary).fade(0.7).hex()}
97
97
  onPress={() => onPress(clockType)}
98
98
  borderless={true}
99
- // RN types bug
100
- hasTVPreferredFocus={undefined}
101
- tvParallaxProperties={undefined}
102
99
  >
103
100
  <View />
104
101
  </TouchableRipple>
@@ -35,6 +35,7 @@ export function TimePickerModal({
35
35
  hours,
36
36
  minutes,
37
37
  label = 'Select time',
38
+ uppercase = true,
38
39
  cancelLabel = 'Cancel',
39
40
  confirmLabel = 'Ok',
40
41
  animationType = 'none',
@@ -42,6 +43,7 @@ export function TimePickerModal({
42
43
  }: {
43
44
  locale?: undefined | string
44
45
  label?: string
46
+ uppercase?: boolean
45
47
  cancelLabel?: string
46
48
  confirmLabel?: string
47
49
  hours?: number | undefined
@@ -134,7 +136,7 @@ export function TimePickerModal({
134
136
  >
135
137
  <View style={styles.labelContainer}>
136
138
  <Text style={[styles.label, { color: theme.colors.text }]}>
137
- {label.toUpperCase()}
139
+ {uppercase ? label.toUpperCase() : label}
138
140
  </Text>
139
141
  </View>
140
142
  <View style={styles.timePickerContainer}>
@@ -155,16 +157,16 @@ export function TimePickerModal({
155
157
  size={24}
156
158
  style={styles.inputTypeToggle}
157
159
  accessibilityLabel="toggle keyboard"
158
- // RN types bug
159
- hasTVPreferredFocus={undefined}
160
- tvParallaxProperties={undefined}
161
160
  />
162
161
  <View style={styles.fill} />
163
- <Button onPress={onDismiss}>{cancelLabel}</Button>
162
+ <Button onPress={onDismiss} uppercase={uppercase}>
163
+ {cancelLabel}
164
+ </Button>
164
165
  <Button
165
166
  onPress={() =>
166
167
  onConfirm({ hours: localHours, minutes: localMinutes })
167
168
  }
169
+ uppercase={uppercase}
168
170
  >
169
171
  {confirmLabel}
170
172
  </Button>
package/src/index.tsx CHANGED
@@ -10,4 +10,5 @@ export { registerTranslation, getTranslation } from './translations/utils'
10
10
  export { default as nl } from './translations/nl'
11
11
  export { default as en } from './translations/en'
12
12
  export { default as pl } from './translations/pl'
13
+ export { default as pt } from './translations/pt'
13
14
  export { default as enGB } from './translations/enGB'
@@ -0,0 +1,20 @@
1
+ import type { TranslationsType } from './utils'
2
+ const de: TranslationsType = {
3
+ save: 'Speichern',
4
+ selectSingle: 'Wähle Datum',
5
+ selectMultiple: 'Wähle Daten',
6
+ selectRange: 'Wähle Zeitspanne',
7
+ notAccordingToDateFormat: (inputFormat) =>
8
+ `Das Format sollte ${inputFormat} sein`,
9
+ mustBeHigherThan: (date) => `Muss nach dem ${date} sein`,
10
+ mustBeLowerThan: (date) => `Muss vor dem ${date} sein`,
11
+ mustBeBetween: (startDate, endDate) =>
12
+ `Muss in dieser Zeitspanne liegen ${startDate} - ${endDate}`,
13
+ dateIsDisabled: 'Datum nicht wählbar',
14
+ previous: 'Vorheriges',
15
+ next: 'Nächstes',
16
+ typeInDate: 'Datum eingeben',
17
+ pickDateFromCalendar: 'Datum vom Kalender auswählen',
18
+ close: 'Schliessen',
19
+ }
20
+ export default de
@@ -5,11 +5,17 @@ const en: TranslationsType = {
5
5
  selectSingle: 'Select date',
6
6
  selectMultiple: 'Select dates',
7
7
  selectRange: 'Select period',
8
- notAccordingToDateFormat: (inputFormat: string) =>
8
+ notAccordingToDateFormat: (inputFormat) =>
9
9
  `Date format must be ${inputFormat}`,
10
- mustBeHigherThan: 'Must be later then',
11
- mustBeLowerThan: 'Must be earlier then',
12
- mustBeBetween: 'Must be between',
10
+ mustBeHigherThan: (date) => `Must be later then ${date}`,
11
+ mustBeLowerThan: (date) => `Must be earlier then ${date}`,
12
+ mustBeBetween: (startDate, endDate) =>
13
+ `Must be between ${startDate} - ${endDate}`,
13
14
  dateIsDisabled: 'Day is not allowed',
15
+ previous: 'Previous',
16
+ next: 'Next',
17
+ typeInDate: 'Type in date',
18
+ pickDateFromCalendar: 'Pick date from calendar',
19
+ close: 'Close',
14
20
  }
15
21
  export default en
@@ -5,11 +5,17 @@ const enGB: TranslationsType = {
5
5
  selectSingle: 'Select date',
6
6
  selectMultiple: 'Select dates',
7
7
  selectRange: 'Select period',
8
- notAccordingToDateFormat: (inputFormat: string) =>
8
+ notAccordingToDateFormat: (inputFormat) =>
9
9
  `Date format must be ${inputFormat}`,
10
- mustBeHigherThan: 'Must be later then',
11
- mustBeLowerThan: 'Must be earlier then',
12
- mustBeBetween: 'Must be between',
10
+ mustBeHigherThan: (date) => `Must be later then ${date}`,
11
+ mustBeLowerThan: (date) => `Must be earlier then ${date}`,
12
+ mustBeBetween: (startDate, endDate) =>
13
+ `Must be between ${startDate} - ${endDate}`,
13
14
  dateIsDisabled: 'Day is not allowed',
15
+ previous: 'Previous',
16
+ next: 'Next',
17
+ typeInDate: 'Type in date',
18
+ pickDateFromCalendar: 'Pick date from calendar',
19
+ close: 'Close',
14
20
  }
15
21
  export default enGB
@@ -5,11 +5,17 @@ const nl: TranslationsType = {
5
5
  selectSingle: 'Selecteer datum',
6
6
  selectMultiple: 'Selecteer datums',
7
7
  selectRange: 'Selecteer periode',
8
- notAccordingToDateFormat: (inputFormat: string) =>
8
+ notAccordingToDateFormat: (inputFormat) =>
9
9
  `Datumformaat moet ${inputFormat} zijn`,
10
- mustBeHigherThan: 'Moet later dan',
11
- mustBeLowerThan: 'Moet eerder dan',
12
- mustBeBetween: 'Moet tussen',
10
+ mustBeHigherThan: (date) => `Moet later dan ${date}`,
11
+ mustBeLowerThan: (date) => `Moet eerder dan ${date}`,
12
+ mustBeBetween: (startDate, endDate) =>
13
+ `Moet tussen ${startDate} - ${endDate}`,
13
14
  dateIsDisabled: 'Deze dag mag niet',
15
+ previous: 'Vorige',
16
+ next: 'Volgende',
17
+ typeInDate: 'Typ datum',
18
+ pickDateFromCalendar: 'Kies datum van kalender',
19
+ close: 'Sluit',
14
20
  }
15
21
  export default nl
@@ -5,11 +5,17 @@ const pl: TranslationsType = {
5
5
  selectSingle: 'Wybierz datę',
6
6
  selectMultiple: 'Wybierz daty',
7
7
  selectRange: 'Wybierz zakres',
8
- notAccordingToDateFormat: (inputFormat: string) =>
8
+ notAccordingToDateFormat: (inputFormat) =>
9
9
  `Data musi mieć format ${inputFormat}`,
10
- mustBeHigherThan: 'Nie wcześniej niż',
11
- mustBeLowerThan: 'Nie później niż',
12
- mustBeBetween: 'Pomiędzy',
10
+ mustBeHigherThan: (date) => `Nie wcześniej niżn ${date}`,
11
+ mustBeLowerThan: (date) => `Nie później niż ${date}`,
12
+ mustBeBetween: (startDate, endDate) => `Pomiędzy ${startDate} - ${endDate}`,
13
13
  dateIsDisabled: 'Niedozwolona data',
14
+
15
+ previous: 'Poprzedni',
16
+ next: 'Dalej',
17
+ typeInDate: 'Wpisz datę',
18
+ pickDateFromCalendar: 'Wybierz datę z kalendarza',
19
+ close: 'Zamknij',
14
20
  }
15
21
  export default pl
@@ -0,0 +1,21 @@
1
+ import type { TranslationsType } from './utils'
2
+
3
+ const pt: TranslationsType = {
4
+ save: 'Salvar',
5
+ selectSingle: 'Selecione a data',
6
+ selectMultiple: 'Selecione as datas',
7
+ selectRange: 'Selecione o período',
8
+ notAccordingToDateFormat: (inputFormat: string) =>
9
+ `O formato da data deve ser ${inputFormat}`,
10
+ mustBeHigherThan: (date) => `Deve ser depois de ${date}`,
11
+ mustBeLowerThan: (date) => `Deve ser antes de ${date}`,
12
+ mustBeBetween: (startDate, endDate) =>
13
+ `Deve estar entre ${startDate} - ${endDate}`,
14
+ dateIsDisabled: 'Data não é permitida',
15
+ previous: 'Anterior',
16
+ next: 'Próximo',
17
+ typeInDate: 'Digite a data',
18
+ pickDateFromCalendar: 'Escolha a data do calendário',
19
+ close: 'Fechar',
20
+ }
21
+ export default pt
@@ -4,17 +4,22 @@ export type TranslationsType = {
4
4
  selectRange: string
5
5
  save: string
6
6
  notAccordingToDateFormat: (inputFormat: string) => string
7
- mustBeHigherThan: string
8
- mustBeLowerThan: string
9
- mustBeBetween: string
7
+ mustBeHigherThan: (date: string) => string
8
+ mustBeLowerThan: (date: string) => string
9
+ mustBeBetween: (startDate: string, endDate: string) => string
10
10
  dateIsDisabled: string
11
+ previous: string
12
+ next: string
13
+ typeInDate: string
14
+ pickDateFromCalendar: string
15
+ close: string
11
16
  }
12
17
 
13
18
  let translationsPerLocale: Record<string, TranslationsType> = {}
14
19
 
15
- export function getTranslation(
20
+ export function getTranslation<K extends keyof TranslationsType>(
16
21
  locale: string | undefined,
17
- key: keyof TranslationsType,
22
+ key: K,
18
23
  fallback?: any
19
24
  ) {
20
25
  const l = locale || 'en'
package/src/.DS_Store DELETED
Binary file