secullum-react-native-ui 4.5.1-beta.3 → 4.6.0
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.
|
@@ -92,7 +92,7 @@ class DatePicker extends React.Component {
|
|
|
92
92
|
React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
|
|
93
93
|
React.createElement(react_native_1.View, null,
|
|
94
94
|
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
95
|
-
React.createElement(react_native_1.Text, { style: styles.value }, value ? (0, format_1.formatDate)(value, '
|
|
95
|
+
React.createElement(react_native_1.Text, { style: styles.value }, value ? (0, format_1.formatDate)(value, 'cccc, dd/MM/yyyy') : '')),
|
|
96
96
|
!disabled && (React.createElement(ImageButton_1.ImageButton, { icon: value && clearable ? 'times' : 'calendar', style: styles.clearIcon, iconColor: value && clearable ? theme.textColor1 : theme.textColor2, onPress: value && clearable ? this.handleClear : this.handlePress, hitBoxSize: 30 })),
|
|
97
97
|
react_native_1.Platform.OS !== 'web' && (React.createElement(react_native_modal_datetime_picker_1.default, { date: value || undefined, isVisible: showModal, onConfirm: this.handleConfirm, onCancel: this.handleCancel, isDarkModeEnabled: isDarkModeEnabled,
|
|
98
98
|
//@ts-ignore
|
|
@@ -96,11 +96,11 @@ class DatePicker extends React.Component {
|
|
|
96
96
|
marginTop: '-150px',
|
|
97
97
|
fontFamily: theme.fontFamily1
|
|
98
98
|
} },
|
|
99
|
-
React.createElement(react_date_range_1.Calendar, { locale: (0, format_1.getDateFnsLocale)(), date: value, onChange: this.handleConfirm }))))));
|
|
99
|
+
React.createElement(react_date_range_1.Calendar, { locale: (0, format_1.getDateFnsLocale)(), date: value, onChange: this.handleConfirm, weekdayDisplayFormat: (0, format_1.getLocale)() === 'pt' ? 'EEEEEE' : 'E' }))))));
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
exports.DatePicker = DatePicker;
|
|
103
103
|
DatePicker.defaultProps = {
|
|
104
104
|
clearable: true,
|
|
105
|
-
dateFormat: '
|
|
105
|
+
dateFormat: 'cccc, dd/MM/yyyy'
|
|
106
106
|
};
|
|
@@ -103,7 +103,7 @@ class RangeDatePicker extends React.Component {
|
|
|
103
103
|
render() {
|
|
104
104
|
const { label, startDate, endDate, style, nativeID } = this.props;
|
|
105
105
|
const { showStartDateModal, showEndDateModal, isDarkModeEnabled } = this.state;
|
|
106
|
-
const displayFormat = 'MMM
|
|
106
|
+
const displayFormat = 'MMM d, yyyy';
|
|
107
107
|
const displayText = (0, format_1.formatDate)(startDate, displayFormat) +
|
|
108
108
|
' - ' +
|
|
109
109
|
(0, format_1.formatDate)(endDate, displayFormat);
|
|
@@ -88,7 +88,7 @@ class RangeDatePicker extends React.Component {
|
|
|
88
88
|
render() {
|
|
89
89
|
const { label, startDate, endDate, style, nativeID } = this.props;
|
|
90
90
|
const { showStartDateModal } = this.state;
|
|
91
|
-
const displayFormat = 'MMM
|
|
91
|
+
const displayFormat = 'MMM d, yyyy';
|
|
92
92
|
const displayText = (0, format_1.formatDate)(startDate, displayFormat) +
|
|
93
93
|
' - ' +
|
|
94
94
|
(0, format_1.formatDate)(endDate, displayFormat);
|
|
@@ -114,7 +114,7 @@ class RangeDatePicker extends React.Component {
|
|
|
114
114
|
endDate: endDate,
|
|
115
115
|
key: 'selection'
|
|
116
116
|
}
|
|
117
|
-
], rangeColors: [theme.backgroundColor3], onChange: this.handleRangeDateConfirm }))))));
|
|
117
|
+
], rangeColors: [theme.backgroundColor3], onChange: this.handleRangeDateConfirm, weekdayDisplayFormat: (0, format_1.getLocale)() === 'pt' ? 'EEEEEE' : 'E' }))))));
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
exports.RangeDatePicker = RangeDatePicker;
|
package/lib/modules/format.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export declare const setLocale: (locale: Locale) => void;
|
|
|
3
3
|
export declare const getLocale: () => Locale;
|
|
4
4
|
export declare const parseDate: (date: string, format: string) => Date;
|
|
5
5
|
export declare const getDateFnsLocale: () => any;
|
|
6
|
-
export declare const formatDate: (date: Date, format: string) => string;
|
|
6
|
+
export declare const formatDate: (date: Date | string, format: string) => string;
|
package/lib/modules/format.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.formatDate = exports.getDateFnsLocale = exports.parseDate = exports.getLocale = exports.setLocale = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
5
|
const dfnslocales = {
|
|
6
|
-
pt: require('date-fns/locale/pt'),
|
|
6
|
+
pt: require('date-fns/locale/pt-BR'),
|
|
7
7
|
en: require('date-fns/locale/en-US'),
|
|
8
8
|
es: require('date-fns/locale/es')
|
|
9
9
|
};
|
|
@@ -21,14 +21,19 @@ const parseDate = (date, format) => {
|
|
|
21
21
|
};
|
|
22
22
|
exports.parseDate = parseDate;
|
|
23
23
|
const getDateFnsLocale = () => {
|
|
24
|
+
let fnsLocate = dfnslocales.en;
|
|
24
25
|
switch (currentLocale) {
|
|
25
26
|
case 'pt':
|
|
26
|
-
|
|
27
|
+
fnsLocate = dfnslocales.pt;
|
|
28
|
+
break;
|
|
27
29
|
case 'es':
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
fnsLocate = dfnslocales.es;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
if (fnsLocate.default) {
|
|
34
|
+
return fnsLocate.default;
|
|
31
35
|
}
|
|
36
|
+
return fnsLocate;
|
|
32
37
|
};
|
|
33
38
|
exports.getDateFnsLocale = getDateFnsLocale;
|
|
34
39
|
const fixPortugueseLowercase = (formattedDate) => {
|
|
@@ -90,7 +95,7 @@ const fixSpanishLowercase = (formattedDate) => {
|
|
|
90
95
|
return formattedDate;
|
|
91
96
|
};
|
|
92
97
|
const formatDate = (date, format) => {
|
|
93
|
-
const formattedDate = (0, date_fns_1.format)(date, format, {
|
|
98
|
+
const formattedDate = (0, date_fns_1.format)(typeof date === 'string' ? new Date(date) : date, format, {
|
|
94
99
|
locale: (0, exports.getDateFnsLocale)()
|
|
95
100
|
});
|
|
96
101
|
switch (currentLocale) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "secullum-react-native-ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@react-native-community/datetimepicker": "^3.0.9",
|
|
23
|
-
"date-fns": "2.
|
|
24
|
-
"react-date-range": "^1.
|
|
23
|
+
"date-fns": "^2.29.3",
|
|
24
|
+
"react-date-range": "^1.4.0",
|
|
25
25
|
"react-native-drawer-layout": "^2.0.0",
|
|
26
26
|
"react-native-elevated-view": "^0.0.6",
|
|
27
27
|
"react-native-masked-text": "^1.7.2",
|