native-pytech 1.0.31 → 1.0.32

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.
@@ -66,20 +66,17 @@ const phoneToText = (phone) => {
66
66
  }
67
67
  return extra ? `${base}${extra}` : base;
68
68
  };
69
- const dateToTextFormat = (date, format = "YYYY-MM-DD") => {
70
- const parts = new Intl.DateTimeFormat('en-CA', {
71
- timeZone: 'America/Argentina/Buenos_Aires',
72
- year: 'numeric',
73
- month: '2-digit',
74
- day: '2-digit',
75
- }).formatToParts(date);
76
- const year = parts.find((part) => part.type === 'year')?.value ?? '';
77
- const month = parts.find((part) => part.type === 'month')?.value ?? '';
78
- const day = parts.find((part) => part.type === 'day')?.value ?? '';
79
- return format
80
- .replace('YYYY', year)
81
- .replace('MM', month)
82
- .replace('DD', day);
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]);
83
80
  };
84
81
  // ------------------- Export -------------------
85
82
  const Formats = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",