native-pytech 1.0.142 → 1.0.144
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.
|
@@ -2,6 +2,7 @@ declare function numberToTextCurrency(value: number): string;
|
|
|
2
2
|
declare const Formats: {
|
|
3
3
|
numberToText: (value: number) => string;
|
|
4
4
|
TextToNumber: (value: string) => number;
|
|
5
|
+
textToDate: (value?: string) => Date | undefined;
|
|
5
6
|
numberToTextCurrency: typeof numberToTextCurrency;
|
|
6
7
|
capitalizeText: (string: string) => string;
|
|
7
8
|
phoneToText: (phone: number | string) => string;
|
|
@@ -16,6 +16,14 @@ const TextToNumber = (value) => {
|
|
|
16
16
|
return 0;
|
|
17
17
|
return isNegative ? -parsed : parsed;
|
|
18
18
|
};
|
|
19
|
+
const textToDate = (value) => {
|
|
20
|
+
if (!value)
|
|
21
|
+
return undefined;
|
|
22
|
+
const date = /^\d{4}-\d{2}-\d{2}$/.test(value)
|
|
23
|
+
? new Date(`${value}T00:00:00-03:00`)
|
|
24
|
+
: new Date(value);
|
|
25
|
+
return Number.isNaN(date.getTime()) ? undefined : date;
|
|
26
|
+
};
|
|
19
27
|
function numberToTextCurrency(value) {
|
|
20
28
|
return new Intl.NumberFormat('es-AR', {
|
|
21
29
|
style: 'currency',
|
|
@@ -75,6 +83,7 @@ const dateToTextFormat = (date, format = 'YYYY-MM-DD') => {
|
|
|
75
83
|
const Formats = {
|
|
76
84
|
numberToText,
|
|
77
85
|
TextToNumber,
|
|
86
|
+
textToDate,
|
|
78
87
|
numberToTextCurrency,
|
|
79
88
|
capitalizeText,
|
|
80
89
|
phoneToText,
|
|
@@ -22,7 +22,6 @@ export default memo(({ children, onSave }) => {
|
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
24
|
const saveEnabled = useValue(() => store.saveEnabled.get());
|
|
25
|
-
console.log('saveEnabled', saveEnabled);
|
|
26
25
|
// onPress
|
|
27
26
|
const onPressSave = useCallback(async () => {
|
|
28
27
|
// Obtengo los valores del store
|