native-pytech 1.0.32 → 1.0.33

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.
@@ -1,3 +1,4 @@
1
+ import { format as DateFormatter } from 'date-fns';
1
2
  const formatter = new Intl.NumberFormat('es-AR');
2
3
  const numberToText = (value) => {
3
4
  const abs = formatter.format(Math.abs(value));
@@ -66,17 +67,14 @@ const phoneToText = (phone) => {
66
67
  }
67
68
  return extra ? `${base}${extra}` : base;
68
69
  };
69
- const dateToTextFormat = (date, format = 'YYYY-MM-DD') => {
70
- const values = {
71
- DD: String(date.getDate()).padStart(2, '0'),
72
- MM: String(date.getMonth() + 1).padStart(2, '0'),
73
- YYYY: String(date.getFullYear()),
74
- YY: String(date.getFullYear()).slice(-2),
75
- HH: String(date.getHours()).padStart(2, '0'),
76
- mm: String(date.getMinutes()).padStart(2, '0'),
77
- ss: String(date.getSeconds()).padStart(2, '0'),
78
- };
79
- return format.replace(/DD|MM|YYYY|YY|HH|mm|ss/g, match => values[match]);
70
+ const dateToTextFormat = (date,
71
+ /**
72
+ Format of the date.
73
+ @default 'YYYY-MM-DD'
74
+ */
75
+ format = 'YYYY-MM-DD') => {
76
+ const _format = format.replaceAll('Y', 'y').replaceAll('m', 'M').replaceAll('D', 'd');
77
+ return DateFormatter(date, _format);
80
78
  };
81
79
  // ------------------- Export -------------------
82
80
  const Formats = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -69,6 +69,7 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "@expo/ui": "~55.0.12"
72
+ "@expo/ui": "~55.0.12",
73
+ "date-fns": "^4.1.0"
73
74
  }
74
75
  }