mg-library 1.0.274 → 1.0.275

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.
package/functions.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import Toast from 'react-native-root-toast';
2
2
  import { StyleSheet } from 'react-native';
3
+ import moment from 'moment';
4
+ import 'moment/locale/es';
5
+ import 'moment/locale/en-gb';
6
+
3
7
  import * as mgConstants from './constants.js';
4
8
 
5
9
  // Strings
@@ -130,4 +134,37 @@ export function showToastWarn(message) {
130
134
  backgroundColor: 'orange'
131
135
  }
132
136
  showToast(config);
137
+ }
138
+
139
+ // Date & Time
140
+
141
+ export function getTimeFormat() {
142
+ return 'HH:mm';
143
+ }
144
+
145
+ export function isValidDate(strDate, language) {
146
+ return moment(strDate, language.dateFormat, true).isValid();
147
+ }
148
+
149
+ export function getDateForBackEnd(date) {
150
+ return new Date(moment(date).format('DD/MM/YYYY HH:mm'));
151
+ }
152
+
153
+ export function capitalize(str) {
154
+ if (typeof str !== 'string')
155
+ return '';
156
+ return str.charAt(0).toUpperCase() + str.slice(1);
157
+ }
158
+
159
+ export function getDateForExposition(date, language) {
160
+ let m = moment(date, language.dateFormat);
161
+ let day = m.format('D');
162
+ let dayName = capitalize(m.format('dddd'));
163
+ let monthName = capitalize(m.format('MMMM'));
164
+ let year = m.format('YYYY');
165
+ return dayName + ', ' + day + ' '+ monthName + ' ' + year;
166
+ }
167
+
168
+ export function getTimeForExposition(date) {
169
+ return moment(date).format('HH:mm');
133
170
  }
package/mg-library.rar CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.274",
3
+ "version": "1.0.275",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,6 +10,7 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "expo": "~50.0.6",
13
+ "moment": "^2.30.1",
13
14
  "react": "18.2.0",
14
15
  "react-native": "0.73.2",
15
16
  "react-native-root-toast": "^3.5.1"